numpy.nbytes 意思不明

numpy.nbytes unclear meaning

来自 numpy 文档:

numpy.ndarray.nbytes¶ attribute

ndarray.nbytes Total bytes consumed by the elements of the array.

Notes

Does not include memory consumed by non-element attributes of the array object.

以下代码:

x = np.zeros((3,5,2), dtype=np.uint64)
x[0].nbytes

输出:

80

为什么?

再次来自 numpy 文档:

numpy.uint64: 64-bit unsigned integer

在python(一般情况下),

切片 x[0] 你得到 10 个元素:

x[0]
array([[0, 0],
       [0, 0],
       [0, 0],
       [0, 0],
       [0, 0]], dtype=uint64)

x[0].size
10

10*880,一切都符合逻辑,不是吗?