Skip to content

Commit d5a83a5

Browse files
angelayipytorchmergebot
authored andcommitted
[export] Fix deserialization of symint (#104722)
Test Plan: CI Differential Revision: D47269143 Pull Request resolved: #104722 Approved by: https://github.com/zhxchen17
1 parent 199e93a commit d5a83a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

torch/_export/serde/serialize.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,11 @@ def deserialize_optional_tensor_args(a):
10371037
raise SerializeError(f"Unhandled argument {inp}")
10381038

10391039
def deserialize_sym_argument(self, sym_int_arg):
1040-
return self.serialized_name_to_node[sym_int_arg.as_name]
1040+
if sym_int_arg.type == "as_int":
1041+
return sym_int_arg.as_int
1042+
else:
1043+
assert sym_int_arg.type == "as_name"
1044+
return self.serialized_name_to_node[sym_int_arg.as_name]
10411045

10421046
def deserialize_sym_op_outputs(self, serialized_node: Node, fx_node: torch.fx.Node):
10431047
self.sync_fx_node(serialized_node.outputs[0].value.as_name, fx_node)

0 commit comments

Comments
 (0)