.size
ndarray.size 數組元素的總個數,相當于 .shape 中 n*m 的值
a = np.array([2,2])
print(a.size)2
.shap
ndarray.shape 數組的維度,對于矩陣,n 行 m 列
a = np.array([2,2])
print(a.shape)
(1,2)
torch.tensor 數組的維度
x = torch.randn(1,64,64,64)
print(x.shape)
torch.Size([1, 64, 64, 64])
.size()
torch.tensor 數組的維度
x = torch.randn(1,64,64,64)
print(x.size())
torch.Size([1, 64, 64, 64])
type()
x = torch.randn(1,64,64,64)
print(type(x))<class 'torch.Tensor'>