1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
import numpy as np np.random.seed(0)
x1 = np.random.randint(10, size=6) x2 = np.random.randint(10, size=(3, 4)) x3 = np.random.randint(10, size=(3, 4, 5))
print("x3 ndim: ", x3.ndim) print("x3 shape:", x3.shape) print("x3 size: ", x3.size)
x3 ndim: 3 x3 shape: (3, 4, 5) x3 size: 60
print("dtype:", x3.dtype)
>>>dtype: int64
print("itemsize:", x3.itemsize, "bytes") print("nbytes:", x3.nbytes, "bytes")
itemsize: 8 bytes nbytes: 480 bytes
|
近期评论