pytorch
900e09c8 - [Dynamo] Support torch.Tensor.fn as TorchVariable, not UserDefinedObjectVariable, preventing graph break (#93243)

Commit
2 years ago
[Dynamo] Support torch.Tensor.fn as TorchVariable, not UserDefinedObjectVariable, preventing graph break (#93243) As found in #92709, thanks to @ngimel and @jansel, currently `torch.Tensor.fn` points to `UserDefinedObjectVariable` rather than `TorchVariable`. The root cause is due to https://github.com/pytorch/pytorch/pull/92709#pullrequestreview-1273357406. To prevent this, build `TorchVariable` of `torch.Tensor.fn` pointing to `torch.ops.aten.fn`. This issue propagates to `torch.Tensor.fn` causing graph break with `nopython=True`. ```python import torch import torch._dynamo as dynamo #op = torch.ops.aten.abs_ # no graph break op = torch.Tensor.abs_ # graph break args = torch.empty(10) def foo(args): return op(args) opt_foo = dynamo.optimize("inductor", nopython=True)(foo) y_ = opt_foo(args) ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/93243 Approved by: https://github.com/jansel
Author
Committer
Parents
Loading