Skip to content

Commit 3d3b7bb

Browse files
bobrenjc93facebook-github-bot
authored andcommitted
Specialize symfloats that flow through is_integer (#139572)
Summary: Fixes `python test/dynamo/test_dynamic_shapes.py DynamicShapesFunctionTests.test_number_method_method_is_integer_num_type6_dynamic_shapes` when specialize_float = False X-link: pytorch/pytorch#139572 Approved by: https://github.com/ezyang ghstack dependencies: #139569, #139457, #139568 Reviewed By: ZainRizvi Differential Revision: D65492888 Pulled By: bobrenjc93 fbshipit-source-id: 9a9881caa5905686c44d8508ce5edab46ab03f28
1 parent 4a42e06 commit 3d3b7bb

File tree

1 file changed

+9
-0
lines changed
  • userbenchmark/dynamo/dynamobench/_dynamo

1 file changed

+9
-0
lines changed

userbenchmark/dynamo/dynamobench/_dynamo/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,6 +2233,15 @@ def get_fake_value(node, tx, allow_non_graph_fake=False):
22332233
# no matter it's lazy module or not, we should copy to fake mode.
22342234
nnmodule = deepcopy_to_fake_tensor(nnmodule, tx.fake_mode)
22352235

2236+
if node.name in ["interpolate", "is_integer"]:
2237+
# We need to specialize symfloats for now. Eventually we should do a tensorify pass in dynamo.
2238+
args = tuple(
2239+
float(arg)
2240+
if isinstance(arg, torch.SymFloat) and arg.node.hint is not None
2241+
else arg
2242+
for arg in args
2243+
)
2244+
22362245
try:
22372246
with tx.fake_mode, enable_python_dispatcher():
22382247
ret_val = wrap_fake_exception(

0 commit comments

Comments
 (0)