pytorch
4b597019 - [Nested Tensor] Created Nested Tensor to Nested Tensor Views (#82658)

Commit
2 years ago
[Nested Tensor] Created Nested Tensor to Nested Tensor Views (#82658) # Summary This is PR is pulling out all the changes from #81838 specific to properly creating nested_tensor views. I will update this comment with a design doc once that has been made. This should enable proper creation of NestedTensor views, two nested_tensors sharing the same buffer_ but with different NestedTensor meta data. The function `create_nested_tensor_view` is a helper function for creating a new nested tensor whose storage aliases the base causing the underlying storage to be shared - and is therefore a view. This function by itself is not differentiable and therefore autograd does not track its uses. If a nested tensor function implementation uses this helper in its implementation the aten_op must meet two requirements: - The function must return a view of the input - The function must be explicit and defines its backward ## Testing A bug was found when creating a base tensor out of inference mode and then creating a view in inference mode. This test has been aded to this PR in order to show the effect of the change. Pull Request resolved: https://github.com/pytorch/pytorch/pull/82658 Approved by: https://github.com/albanD
Author
Committer
Parents
Loading