pytorch
8ba87fa5 - [dynamo] fix general attr on tensor for user-provided attributes (#94332)

Commit
1 year ago
[dynamo] fix general attr on tensor for user-provided attributes (#94332) **Problem**: For a tensor `x`, you can assign `x.my_attr = 3.14` and then later access it. Dynamo does not support this right now; it errors out with an AttributError (it was broken in #91840). **Fix**: This fixes the problem by catching AttributeErrors in dynamo if we try to access an attr that does not exist on a standard torch.Tensor. **Tests**: Added tests for accessing and setting attributes to make sure dynamo does not error out. Pull Request resolved: https://github.com/pytorch/pytorch/pull/94332 Approved by: https://github.com/yanboliang
Author
Committer
Parents
Loading