Skip to content

Commit

Permalink
Ignore .numpy() under FakeTensorMode() (#120261)
Browse files Browse the repository at this point in the history
Summary:
Fixes #120259

X-link: pytorch/pytorch#120261
Approved by: https://github.com/jansel

Reviewed By: jeanschmidt

Differential Revision: D54123967

fbshipit-source-id: 1e41321385fc5f8924e26775ddf6a6292c2ad6c6
  • Loading branch information
Thiago Crepaldi authored and facebook-github-bot committed Feb 24, 2024
1 parent a099658 commit 26b85ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,8 @@ def nnmodule_has_hooks(

def to_numpy_helper(value):
"""Convert tensor and tnp.ndarray to numpy.ndarray."""
if is_fake(value):
return value
if isinstance(value, tnp.ndarray):
return to_numpy_helper(value.tensor)
elif isinstance(value, torch.Tensor):
Expand Down

0 comments on commit 26b85ea

Please sign in to comment.