shape 和 size() 区别

shape 是属性,size() 是方法。

shape 是 numpy 中的 array 和 pytorch 中的 tensor 通用的。size() 只能用在 tensor 上。

shape[i]、size(i) 和 size()[i] 结果是一样的。

你可能感兴趣的:(编程,shape,size)