mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[fx] fix qualified name for methods of torch.Tensor (#162407)
This fixes an error in the previous PR. Pull Request resolved: https://github.com/pytorch/pytorch/pull/162407 Approved by: https://github.com/ezyang, https://github.com/XuehaiPan
This commit is contained in:
committed by
PyTorch MergeBot
parent
8494afb837
commit
4590438329
@ -2998,7 +2998,7 @@ class CommonTemplate:
|
||||
x = torch.rand(10)
|
||||
|
||||
with x.device:
|
||||
out = torch.compile(fn)(x)
|
||||
out = torch.compile(fn, backend=lambda gm, _: gm)(x)
|
||||
ref = fn(x)
|
||||
for a, b in zip(out, ref):
|
||||
self.assertTrue(torch.allclose(a, b))
|
||||
|
@ -155,7 +155,7 @@ def _get_qualified_name(func: Callable[..., Any]) -> str:
|
||||
isinstance(func, (types.MethodDescriptorType, types.WrapperDescriptorType))
|
||||
and func is getattr(torch.Tensor, func.__name__, None)
|
||||
) or (
|
||||
func.__module__ == torch._tensor
|
||||
func.__module__ == torch._tensor.__name__
|
||||
and func.__qualname__ == f"Tensor.{func.__name__}"
|
||||
):
|
||||
return f"torch.Tensor.{func.__name__}"
|
||||
|
Reference in New Issue
Block a user