Skip to content

Commit

Permalink
specialize symfloats for wrapped_gradient in get_fake_value (#139935)
Browse files Browse the repository at this point in the history
Summary:
Fixes `PYTORCH_TEST_WITH_DYNAMO=1 python test/test_torch.py TestTorchDeviceTypeCPU.test_gradient_type_promotion_cpu` when `specialize_float=False`

Reviewers might wonder why we need to have this whitelist. Can't we rely on python_arg_parser.h to do the specialization generically? Alas this path doesn't actually FFI to C++ so we do need to do the specialization in pythonland.

X-link: pytorch/pytorch#139935
Approved by: https://github.com/ezyang
ghstack dependencies: #139569, #139457, #139568, #139572, #139846, #139454, #139896

Reviewed By: ZainRizvi

Differential Revision: D65661211

Pulled By: bobrenjc93

fbshipit-source-id: a75d733e6191e8f884108dab3ef94f92d396e105
  • Loading branch information
bobrenjc93 authored and facebook-github-bot committed Nov 8, 2024
1 parent 165a4bd commit ff80dde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ def get_fake_value(node, tx, allow_non_graph_fake=False):
# no matter it's lazy module or not, we should copy to fake mode.
nnmodule = deepcopy_to_fake_tensor(nnmodule, tx.fake_mode)

if node.name in ["interpolate", "is_integer"]:
if node.name in ["interpolate", "is_integer", "wrapped_gradient"]:
# We need to specialize symfloats for now. Eventually we should do a tensorify pass in dynamo.
args = tuple(
float(arg)
Expand Down

0 comments on commit ff80dde

Please sign in to comment.