pytorch / nestedtensor

[Prototype] Tools for the concurrent manipulation of variably sized Tensors.
BSD 3-Clause "New" or "Revised" License
252 stars 28 forks source link

nt.shape doesn't work #471

Open Acciorocketships opened 2 years ago

Acciorocketships commented 2 years ago

🐛 Bug

shape, size, dim, nested_size, nested_dim, tensor_dim, etc don't work.

To Reproduce

Steps to reproduce the behaviour:

initialise nestedtensor nt and call nt.shape

>>> import torch
>>> x = torch.nested_tensor([torch.rand(2), torch.rand(3)])
<stdin>:1: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/NestedTensorImpl.cpp:99.)
>>> x.shape
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Internal error: NestedTensorImpl doesn't support sizes. Please file an issue on https://github.com/pytorch/nestedtensor

Expected behavior

Expected the same behaviour as seen in the example colab https://colab.research.google.com/github/pytorch/nestedtensor/blob/master/tutorials/notebooks/basic.ipynb#scrollTo=STGxLWXXVg5Z

Environment

Tested with torch 1.13.0.dev20220713 on both python3.8 and python3.9

cpuhrsch commented 2 years ago

Hello @Acciorocketships,

This is actually not a but. We simply haven't migrated the entirety of NestedTensor to core yet. Could I kindly ask you to open a feature request on https://github.com/pytorch/pytorch/issues that also details your intended usage of NestedTensor?

Thanks, Christian

Acciorocketships commented 2 years ago

Okay, I just did. Is it possible/straightforward to migrate the rest of the library to core?

On Wed, Jul 13, 2022 at 3:37 PM cpuhrsch @.***> wrote:

Hello @Acciorocketships https://github.com/Acciorocketships,

This is actually not a but. We simply haven't migrated the entirety of NestedTensor to core yet. Could I kindly ask you to open a feature request on https://github.com/pytorch/pytorch/issues that also details your intended usage of NestedTensor?

Thanks, Christian

— Reply to this email directly, view it on GitHub https://github.com/pytorch/nestedtensor/issues/471#issuecomment-1183307306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFIYAQCC3UFL7CGJLYBCPF3VT3IBDANCNFSM53O6JUAQ . You are receiving this because you were mentioned.Message ID: @.***>

cpuhrsch commented 2 years ago

@Acciorocketships, it is definitely possible and we're working on it cc @jbschlosser

marwanghalib commented 2 years ago

@Acciorocketships , I am running into the same issue. Were you able to migrate the rest of NestedTensor to core for your purposes? Thank you.