# numpy
arr = np.array([[10,2,3],[12,2,4]])
arr_size =arr.size
arr_shape = arr.shape
# Tensor
arr = torch.arange(10).reshape(2,5)
arr_size = arr.size()
arr_shape = arr.shape
python shape和size
于 2024-07-01 17:29:18 首次发布
# numpy
arr = np.array([[10,2,3],[12,2,4]])
arr_size =arr.size
arr_shape = arr.shape
# Tensor
arr = torch.arange(10).reshape(2,5)
arr_size = arr.size()
arr_shape = arr.shape