pytorch/torch/csrc/jit/api
Sean Silva 34d9278c19 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
2021-03-09 05:45:57 -08:00
..
compilation_unit.h [WIP] JIT Static Hooks: adding hooks to class type and adding logic for hook running/compilation (#49544) 2021-01-20 09:09:30 -08:00
function_impl.cpp [DI] Allow explicit taskLauncher for torchscript interpreter (#46865) 2020-11-04 17:07:55 -08:00
function_impl.h [DI] Allow explicit taskLauncher for torchscript interpreter (#46865) 2020-11-04 17:07:55 -08:00
method.h Expose run_async function on torch::jit::Method (#48607) 2020-12-11 11:17:58 -08:00
module_save.cpp [JIT] Enable saving modules with hooks in FBCODE (#51241) 2021-02-01 17:01:44 -08:00
module.cpp Remove notion of "level" from Module::dump_to_str. (#52539) 2021-03-09 05:45:57 -08:00
module.h Remove notion of "level" from Module::dump_to_str. (#52539) 2021-03-09 05:45:57 -08:00
object.cpp [jit][api][refactor] remove redundant deepcopy implementation (#37538) 2020-05-06 15:41:33 -07:00
object.h Add property binding in torchbind (#50670) 2021-03-03 14:25:52 -08:00