Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.
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

@erichan1

Description

@erichan1

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions