forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for as_nested_tensor() with jagged layout + fixed nested_tens…
…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
- Loading branch information
1 parent
cdca441
commit fc3ae96
Showing
2 changed files
with
109 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters