Skip to content

Commit 7d40140

Browse files
gchananapaszke
authored andcommitted
Document squeeze behavior on 1-dimensional tensors of size 1. (pytorch#1470)
1 parent e50c7da commit 7d40140

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

torch/_torch_docs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3690,6 +3690,9 @@
36903690
If `input` is of shape: :math:`(A x 1 x B)`, `squeeze(input, 0)` leaves the Tensor unchanged,
36913691
but `squeeze(input, 1)` will squeeze the tensor to the shape :math:`(A x B)`.
36923692
3693+
.. note:: As an exception to the above, a 1-dimensional tensor of size 1 will not
3694+
have its dimensions changed.
3695+
36933696
.. note:: The returned Tensor shares the storage with the input Tensor,
36943697
so changing the contents of one will change the contents of the other.
36953698

0 commit comments

Comments
 (0)