Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Cannot index into a NestedTensor with grad ie nt[0] #472

Open
erichan1 opened this issue Jul 27, 2022 · 0 comments
Open

Cannot index into a NestedTensor with grad ie nt[0] #472

erichan1 opened this issue Jul 27, 2022 · 0 comments

Comments

@erichan1
Copy link
Member

erichan1 commented Jul 27, 2022

🐛 Bug

Can index into a NestedTensor without grad, but cannot index into a NestedTensor with grad

To Reproduce

Steps to reproduce the behavior:

import torch
c = torch.Tensor([1,2])
d = torch.nested_tensor([c,c])
print(d[0]) # works
d.requires_grad=True
print(d[0]) # fails
Traceback (most recent call last):
  File "/fsx/users/erichan1/work/erichan1_test/random/nt_index_test.py", line 6, in <module>
    print(d[0]) # fails
RuntimeError: Internal error: NestedTensorImpl doesn't support sizes. Please file an issue on https://github.com/pytorch/nestedtensor

Expected behavior

The second print should print tensor([1., 2.]), but fails instead.

Environment

  • PyTorch Version (e.g., 1.0): 1.13.0a0+gitfd17ac2
  • OS (e.g., Linux): Linux
  • How you installed PyTorch (conda, pip, source): Pip
  • Build command you used (if compiling from source): pip install -e . (python setup.py develop)
  • Python version: 3.9
  • CUDA/cuDNN version: n/a
  • GPU models and configuration: n/a
  • Any other relevant information:

Additional context

n/a

@erichan1 erichan1 changed the title Cannot index into a NestedTensor without grad ie nt[0] Cannot index into a NestedTensor with grad ie nt[0] Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant