[Dynamo] Handle extracted unbound tensor methods (#137227)

fixes2

Pull Request resolved: https://github.com/pytorch/pytorch/pull/137227
Approved by: https://github.com/williamwen42, https://github.com/anijain2305
ghstack dependencies: #137114, #137115, #137116, #137117, #137120
This commit is contained in:
Michael Lazos
2024-10-08 14:11:04 -07:00
committed by PyTorch MergeBot
parent b3f30c9bc3
commit 0a304d9048
15 changed files with 24 additions and 5 deletions

View File

@ -938,6 +938,16 @@ class FunctionTests(torch._dynamo.test_case.TestCase):
else:
return x - 1
@make_test
def test_tensor_size(x):
fn = torch.Tensor.size
return fn(x + 1)
@make_test
def test_tensor_dim(x):
fn = torch.Tensor.dim
return fn(x + 1)
@make_test
def test_tensor_is_inference(x):
if x.is_inference():