pytorch/torch/csrc/jit/python
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
..
init.cpp [NNC] Implementation for aten::cat without conditionals. (#53128) 2021-03-07 22:57:02 -08:00
init.h
module_python.h
pybind_utils.cpp Graceful invalidation of Python Node/Value/Block when C++ object is deleted (#50326) 2021-02-04 01:34:46 -08:00
pybind_utils.h [WIP][FX] Fix tracing support for torchbind (#52884) 2021-03-05 23:40:16 -08:00
pybind.h Graceful invalidation of Python Node/Value/Block when C++ object is deleted (#50326) 2021-02-04 01:34:46 -08:00
python_arg_flatten.cpp [ONNX] ONNX dev branch merge 01-06-2021 (#50163) 2021-01-13 13:51:21 -08:00
python_arg_flatten.h Move torch/csrc/utils/hash.h to c10/util/hash.h. (#42503) 2020-08-29 17:47:00 -07:00
python_custom_class.cpp [JIT] Add static method support for TorchBind (#51177) 2021-02-13 19:41:27 -08:00
python_custom_class.h
python_interpreter.cpp
python_ir.cpp Context manager for hiding source ranges (#53188) 2021-03-04 09:11:08 -08:00
python_ir.h
python_ivalue.h Remove DataPtr extractor from CUDAFuture (#48840) 2020-12-19 11:03:45 -08:00
python_sugared_value.cpp [JIT] Add static method support for TorchBind (#51177) 2021-02-13 19:41:27 -08:00
python_sugared_value.h Fix clang-tidy warnings in python_sugared_value.{h,cpp} (#51703) 2021-02-04 21:29:40 -08:00
python_tracer.cpp [Usability] Capture argument names for traced functions and modules (#51775) 2021-02-10 18:28:08 -08:00
python_tracer.h [Usability] Capture argument names for traced functions and modules (#51775) 2021-02-10 18:28:08 -08:00
python_tree_views.cpp Add dict comprehension (#47774) 2020-12-17 15:25:30 -08:00
python_tree_views.h
script_init.cpp Remove notion of "level" from Module::dump_to_str. (#52539) 2021-03-09 05:45:57 -08:00
script_init.h
update_graph_executor_opt.cpp
update_graph_executor_opt.h