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

Commit 2184b22

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

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tests/test_modules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class NNModuleTests(torchdynamo.testing.TestCase):
196196
test_iseval2 = make_test(IsEvalCheck())
197197
test_viamodulecall = make_test(ViaModuleCall())
198198
test_isnonelayer = make_test(IsNoneLayer())
199+
test_intarg = make_test(IntArg())
199200

200201
# not yet implemented
201202
# test_layerlist = make_test(LayerList())

torchdynamo/symbolic_convert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import functools
55
import inspect
66
import itertools
7+
from numbers import Real
78
import operator
89
import types
910
import typing
@@ -178,7 +179,7 @@ def wrap_local(self, name, value):
178179
state=TracingSupported.YES,
179180
guards={Guard(name, GuardSource.LOCAL, GuardBuilder.VALUE_MATCH)},
180181
)
181-
elif value is True or value is False or value is None:
182+
elif value is True or value is False or value is None or isinstance(value, Real):
182183
# For these, just specialize on exact value
183184
return ConstantVariable(
184185
value=value,

0 commit comments

Comments
 (0)