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
Support for as_nested_tensor() with jagged layout + fixed nested_tensor() semantics #112304
Conversation
…or() semantics [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/112304
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 58f0798 with merge base 128f4db (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…or() semantics ghstack-source-id: 61b633c07d4c6309678ab13f57468d8bb4ce2afb Pull Request resolved: #112304
@pytorchbot merge |
Thanks for sending this! I think it looks good. Good follow up work for |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…or() semantics (pytorch#112304) This PR: * Adds support for the `layout` kwarg to `torch.nested.as_nested_tensor()` * Fixes `torch.nested.nested_tensor()` * It should accept a list of lists of scalars * It should not preserve autograd history * Adds extensive testing for these two functions Semantics for the two functions follow those of the strided layout: * `torch.nested.nested_tensor(tensor_list, layout=torch.jagged)`: Creates a new jagged layout NT **with no autograd history** * `tensor_list` can be a list of Tensors or list of lists of scalars * `torch.nested.as_nested_tensor(tensor_list, layout=torch.jagged)`: Creates a new jagged layout NT **preserving autograd history of `tensor_list`** * `tensor_list` must be a list of Tensors Pull Request resolved: pytorch#112304 Approved by: https://github.com/cpuhrsch, https://github.com/soulitzer
…or() semantics (pytorch#112304) This PR: * Adds support for the `layout` kwarg to `torch.nested.as_nested_tensor()` * Fixes `torch.nested.nested_tensor()` * It should accept a list of lists of scalars * It should not preserve autograd history * Adds extensive testing for these two functions Semantics for the two functions follow those of the strided layout: * `torch.nested.nested_tensor(tensor_list, layout=torch.jagged)`: Creates a new jagged layout NT **with no autograd history** * `tensor_list` can be a list of Tensors or list of lists of scalars * `torch.nested.as_nested_tensor(tensor_list, layout=torch.jagged)`: Creates a new jagged layout NT **preserving autograd history of `tensor_list`** * `tensor_list` must be a list of Tensors Pull Request resolved: pytorch#112304 Approved by: https://github.com/cpuhrsch, https://github.com/soulitzer
…or() semantics (pytorch#112304) This PR: * Adds support for the `layout` kwarg to `torch.nested.as_nested_tensor()` * Fixes `torch.nested.nested_tensor()` * It should accept a list of lists of scalars * It should not preserve autograd history * Adds extensive testing for these two functions Semantics for the two functions follow those of the strided layout: * `torch.nested.nested_tensor(tensor_list, layout=torch.jagged)`: Creates a new jagged layout NT **with no autograd history** * `tensor_list` can be a list of Tensors or list of lists of scalars * `torch.nested.as_nested_tensor(tensor_list, layout=torch.jagged)`: Creates a new jagged layout NT **preserving autograd history of `tensor_list`** * `tensor_list` must be a list of Tensors Pull Request resolved: pytorch#112304 Approved by: https://github.com/cpuhrsch, https://github.com/soulitzer
Stack from ghstack (oldest at bottom):
This PR:
layout
kwarg totorch.nested.as_nested_tensor()
torch.nested.nested_tensor()
Semantics for the two functions follow those of the strided layout:
torch.nested.nested_tensor(tensor_list, layout=torch.jagged)
: Creates a new jagged layout NT with no autograd historytensor_list
can be a list of Tensors or list of lists of scalarstorch.nested.as_nested_tensor(tensor_list, layout=torch.jagged)
: Creates a new jagged layout NT preserving autograd history oftensor_list
tensor_list
must be a list of Tensors