.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'>