torchgfn icon indicating copy to clipboard operation
torchgfn copied to clipboard

Use `torch.nested.nested_tensor` when it's not a prototype anymore

Open vict0rsch opened this issue 1 year ago • 3 comments

https://pytorch.org/docs/stable/nested.html#module-torch.nested

vict0rsch avatar May 26 '23 19:05 vict0rsch

>>> a
tensor([0, 1, 2])
>>> b
tensor([3, 4, 5, 6, 7])
>>> nt = torch.nested.nested_tensor([a, b])
>>> nt
nested_tensor([
  tensor([0, 1, 2]),
  tensor([3, 4, 5, 6, 7])
])

vict0rsch avatar May 26 '23 19:05 vict0rsch

Oh nice -- this is for storing trajectories of different lengths (for e.g.)?

josephdviviano avatar Jun 01 '23 14:06 josephdviviano

Yes!

vict0rsch avatar Jun 01 '23 14:06 vict0rsch