pytorch
34d9278c - Remove notion of "level" from `Module::dump_to_str`. (#52539)

Commit
3 years ago
Remove notion of "level" from `Module::dump_to_str`. (#52539) Summary: The code uses `torch::jit::jit_log_prefix` for handling recursive indenting in most places in this function. There was one place that was using "level", but it was buggy -- it would result in a compounding superlinear indent. Note that changing it to "level+1" doesn't fix the bug. Before/after: https://gist.github.com/silvasean/8ee3ef115a48de6c9c54fbc40838d8d7 The new code establishes a recursive invariant for `Module::dump_to_str`: the function returns the module printed at the base indent level (i.e. no indent). `torch::jit:log_prefix` is used to prefix recursive calls. The code was already nearly there, except for this spurious use of "level". Pull Request resolved: https://github.com/pytorch/pytorch/pull/52539 Reviewed By: navahgar Differential Revision: D26773657 Pulled By: gmagogsfm fbshipit-source-id: ab476f0738bf07de9f40d168dd038dbf62a9a79e
Author
Parents
Loading