8000 Update on "[symbolic shapes] Log SymNode id for provenance" · pytorch/pytorch@92c0f4a · GitHub
[go: up one dir, main page]

Skip to content

Commit 92c0f4a

Browse files
committed
Update on "[symbolic shapes] Log SymNode id for provenance"
We can use the SymNode id to point us back to how previous expressions were created, and construct this nice tree in tlparse: <img width="761" alt="image" src="https://github.com/user-attachments/assets/531b03e8-4398-4d0a-bd11-16078256041c" /> cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv [ghstack-poisoned]
2 parents 6f17b53 + 0d0acdb commit 92c0f4a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

torch/fx/experimental/sym_node.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,9 +1295,9 @@ def wrapper(self, other=None):
12951295
del frame
12961296

12971297
if other is not None:
1298-
arguments = [str(self), str(other)]
1298+
arguments = [self, other]
12991299
else:
1300-
arguments = [str(self)]
1300+
arguments = [self]
13011301

13021302
def get_id(sym_node) -> Optional[int]:
13031303
# We don't want to return an ID if the input is a constant
@@ -1309,8 +1309,10 @@ def get_id(sym_node) -> Optional[int]:
13091309
"method": method,
13101310
"result": str(result),
13111311
"result_id": id(result),
1312-
"arguments": arguments,
1313-
"argument_ids": [i for i in arguments if i is not None],
1312+
"arguments": [str(a) for a in arguments],
1313+
"argument_ids": [
1314+
get_id(i) for i in arguments if get_id(i) is not None
1315+
],
13141316
"user_bottom_stack": str(user_bottom_stack),
13151317
"user_top_stack": str(user_top_stack),
13161318
"floc": str(floc),

0 commit comments

Comments
 (0)
0