torch.Tensor.shape — PyTorch 2.7 documentation (original) (raw)
Tensor.shape¶
Returns the size of the self
tensor. Alias for size.
See also Tensor.size().
Example:
t = torch.empty(3, 4, 5) t.size() torch.Size([3, 4, 5]) t.shape torch.Size([3, 4, 5])