Add debug repr to SymNode (#129925)

Fixes #129403

Create a separate printing function to debug SymNode, since we can't easily change `__repr__` that is used by GraphModule.recompile() to create a pythonic version of a graph

This is my first contribution, please let me know if there is anything that I should look into in further details

Thank you for you guidance! 🙏 I hope to contribute more in the future!

@aorenste
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129925
Approved by: https://github.com/aorenste
This commit is contained in:
Bertrand Thia
2024-07-12 18:31:21 +00:00
committed by PyTorch MergeBot
parent 2c4303c1d1
commit 43b98fa521
5 changed files with 27 additions and 3 deletions

View File

@ -1284,6 +1284,9 @@ void initJITBindings(PyObject* module) {
.def(
"__repr__",
[](c10::SymNode a) { return a->str(); })
.def(
"_graph_repr",
[](c10::SymNode a) { return a->_graph_repr(); })
.def(
"is_constant",
[](const c10::SymNode& node){