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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NestedTensor] multiply batch and ragged dimension to get shape of values tensor #125940

Open
davidberard98 opened this issue May 10, 2024 · 2 comments
Labels
module: nestedtensor NestedTensor tag see issue #25032 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@davidberard98
Copy link
Contributor

davidberard98 commented May 10, 2024

馃殌 The feature, motivation and pitch

From @albanD:

I would argue that it would be so cool to be able to do something like:

# Assume I want a new Tensor with the first two dimensions collapsed
nested_size = my_nested_tensor.size()
nested_size[1] = nested_size[0] * nested_size[1]
nested_size.pop(0)
my_new_nested_tensor = torch.zeros(nested_size)

#124687 (comment)

Alternatives

I think this is just the same as nt.values().

Additional context

No response

cc @cpuhrsch @jbschlosser @bhosmer @drisspg @soulitzer

@davidberard98 davidberard98 added the module: nestedtensor NestedTensor tag see issue #25032 label May 10, 2024
@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label May 10, 2024
@albanD
Copy link
Collaborator

albanD commented May 13, 2024

cc @ezyang because I guess that's in line with what you meant during Triage meeting saying that NestedInt should be be a first class citizen?

@ezyang
Copy link
Contributor

ezyang commented May 14, 2024

Not really lol.

This is an interesting request. I'm not sure it can actually be doable this way though. There are some equations that don't hold in @bhosmer style fold formulation. With fold semantics, (B, *, E) is represented as (B, [s1, s2, s3, ... sb], E), but we already want scalar multiplication by nested int to denote scaling the nested int by that amount (because this is good for stride formulas).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: nestedtensor NestedTensor tag see issue #25032 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

4 participants