Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit d0efbca

Browse files
author
Ansley Adelaide Ussery
committed
Support wrapping Real types
1 parent 2184b22 commit d0efbca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

torchdynamo/symbolic_convert.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ def wrap_local(self, name, value):
171171
state=TracingSupported.YES,
172172
guards={Guard(name, GuardSource.LOCAL, GuardBuilder.TYPE_MATCH)},
173173
)
174+
elif isinstance(value, Real):
175+
self.graphargs.append(LocalArg(name))
176+
self.create_graph_input(name)
177+
return ConstantVariable(
178+
value=value,
179+
state=TracingSupported.UNKNOWN,
180+
guards={Guard(name, GuardSource.LOCAL, GuardBuilder.VALUE_MATCH)},
181+
)
174182
elif isinstance(value, torch.nn.Module):
175183
key = f"{name}_{next(self.cnt)}"
176184
self.nn_modules[key] = value
@@ -179,7 +187,7 @@ def wrap_local(self, name, value):
179187
state=TracingSupported.YES,
180188
guards={Guard(name, GuardSource.LOCAL, GuardBuilder.VALUE_MATCH)},
181189
)
182-
elif value is True or value is False or value is None or isinstance(value, Real):
190+
elif value is True or value is False or value is None:
183191
# For these, just specialize on exact value
184192
return ConstantVariable(
185193
value=value,

0 commit comments

Comments
 (0)