pytorch
129e99fb - __getitem__: Ensure Tensor subclasses are not treated as tuples (#67202)

Commit
3 years ago
__getitem__: Ensure Tensor subclasses are not treated as tuples (#67202) Summary: Fixes https://github.com/pytorch/pytorch/issues/67027 `torch.Tensor` is considered a Mapping, but not a Sequence in Python because it uses `tp_as_mapping` instead of defining `__getitem__` in Python. However, If you try to overwrite `__getitem__` from Python it is considered a `Sequence` and so the tensor is treated like a tuple for indexing purposes. Pull Request resolved: https://github.com/pytorch/pytorch/pull/67202 Reviewed By: VitalyFedyunin Differential Revision: D31908515 Pulled By: albanD fbshipit-source-id: 0ca55a36be3421f96428a8eacf5d195646252b38
Author
Parents
Loading