-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RecursionError when used on subclass of Tensor #65
Comments
I'm confused, why is a a view here? |
So the answer is: This actually seems like a Pytorch bug. a = torch.ones(1)
b = torch.Tensor(a)
print(b._is_view()) # True
print(b._base is a) # True a = torch.ones(1)
c = DummyTensor(a)
print(c._is_view()) # True
print(c._base is a) # False
print(type(c._base)) # <class '__main__.DummyTensor'>
|
Yeah, agreed this is a bug. |
As a workaround, do the
|
Fixes szagoruyko/pytorchviz#65 An alternate implementation of this PR would be to remove the __torch_function__ interposition points for these accessors entirely. In the end, I decided to opt for extra expressivity. See torch.overrides for the criterion on how I decided which accessors should get the nowrap treatment. Signed-off-by: Edward Z. Yang <ezyang@fb.com> [ghstack-poisoned]
Fixes szagoruyko/pytorchviz#65 An alternate implementation of this PR would be to remove the __torch_function__ interposition points for these accessors entirely. In the end, I decided to opt for extra expressivity. See torch.overrides for the criterion on how I decided which accessors should get the nowrap treatment. Signed-off-by: Edward Z. Yang <ezyang@fb.com> ghstack-source-id: 92c718fcc1e2ef32fad11d1e33cde48875c2945a Pull Request resolved: #60464
Summary: Pull Request resolved: #60464 Fixes szagoruyko/pytorchviz#65 An alternate implementation of this PR would be to remove the __torch_function__ interposition points for these accessors entirely. In the end, I decided to opt for extra expressivity. See torch.overrides for the criterion on how I decided which accessors should get the nowrap treatment. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Reviewed By: albanD Differential Revision: D29302835 Pulled By: ezyang fbshipit-source-id: fbe0ac4530a6cc9d6759a3fdf5514d4d7b1f7690
This is indeed fixed by pytorch/pytorch#60464. |
When using subclasses of Tensor,
make_dot
crashed withRecursionError
.Output:
The reason is because
a
is a view, so isa._base
, so isa._base._base
, so isa._base._base._base
, etc.https://colab.research.google.com/drive/1VlAEQY5lOtp3MsYfgyCkrNmkjzuKoRX1?usp=sharing
The text was updated successfully, but these errors were encountered: