評價此頁

torch.Tensor.shape#

Tensor.shape#

返回 `self` 張量的大小。是 size 的別名。

另請參閱 Tensor.size()

示例

>>> t = torch.empty(3, 4, 5)
>>> t.size()
torch.Size([3, 4, 5])
>>> t.shape
torch.Size([3, 4, 5])