pytorch/torch/csrc/jit/python
Luthaf 000368b092 Allow C++ custom class to define __repr__ and use it from Python (#100724)
When handling custom classes from Python, it is nice to be able to specify how they are displayed to the user.

Out of the two standard functions to do this, only `__str__` could be implemented in C++. This PR add `__repr__` to the allowlist of magic methods.

The second commit tweaks the default output of `__str__` to make it more informative, but I can remove the change if you want.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100724
Approved by: https://github.com/ezyang
2023-05-10 15:46:45 +00:00
..
init.cpp Optionally ignore utf-8 decoding error when converting std::string to python str. (#97282) 2023-03-23 01:19:08 +00:00
init.h
module_python.h
pybind_utils.cpp make torch/csrc/jit/python/pybind_utils.cpp data_ptr-correct (#100682) 2023-05-05 15:53:06 +00:00
pybind_utils.h Revert "Reduce includes of CUDACachingAllocator.h (#97072)" 2023-04-07 06:15:11 +00:00
pybind.h
python_arg_flatten.cpp
python_arg_flatten.h
python_custom_class.cpp
python_custom_class.h
python_dict.cpp
python_dict.h
python_interpreter.cpp
python_ir.cpp Add Symbool support in python to C++ translation (#98453) 2023-04-12 03:21:57 +00:00
python_ir.h
python_ivalue.h
python_list.cpp
python_list.h
python_sugared_value.cpp [JIT] clarify errors due to non-literal indexing into ModuleList, ModuleDict (#98606) 2023-04-18 02:53:53 +00:00
python_sugared_value.h [JIT] Partially support ForwardRef type annotations for NamedTuple attributes (#96933) 2023-03-22 15:20:38 +00:00
python_tracer.cpp do not need to check if element in dict input is Tensor. (#97866) 2023-03-31 19:39:00 +00:00
python_tracer.h
python_tree_views.cpp
python_tree_views.h
script_init.cpp Allow C++ custom class to define __repr__ and use it from Python (#100724) 2023-05-10 15:46:45 +00:00
script_init.h
update_graph_executor_opt.cpp
update_graph_executor_opt.h
utf8_decoding_ignore.cpp Optionally ignore utf-8 decoding error when converting std::string to python str. (#97282) 2023-03-23 01:19:08 +00:00
utf8_decoding_ignore.h Optionally ignore utf-8 decoding error when converting std::string to python str. (#97282) 2023-03-23 01:19:08 +00:00