Skip to content
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

[Feature Request] Support for nested tensors #99

Open
vmoens opened this issue Dec 2, 2022 · 0 comments
Open

[Feature Request] Support for nested tensors #99

vmoens opened this issue Dec 2, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@vmoens
Copy link
Contributor

vmoens commented Dec 2, 2022

Motivation

Support for nested tensors should work as torch.stack(tensordicts, 0)
(we can't currently override torch.nested.as_nested_tensor so we'll need to write a custom op)

We don't need to subclass TensorDict for this but there are a few caveats:

  1. Reshaping won't be allowed
  2. Shape can't be accessed
  3. Indexing can only be done on the first dim

For instance, populating a tensordict with a nested tensor won't work as we can't access the shape.

  • If nested tensors are found in a tensordict, all tensors should have that feature.

  • Indexing such a tensordict along the second dimension will require:

  1. splitting the tensors that are nested
  2. indexing those tensors
  3. re-nesting them
@vmoens vmoens added the enhancement New feature or request label Dec 2, 2022
@vmoens vmoens self-assigned this Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant