>>> import numpy as np
>>> a = np.array([1, 2, 3])
>>> a.shape
(3,)
>>> b = np.array([1, 2])
>>> b.shape
(2,)
>>> c = np.array([[1], [2]])
>>> c.shape
(2, 1)
>>> d = np.array([[1, 2]])
>>> d.shape
(1, 2)
>>> e = np.array([[1], [2], [3], [4]])
>>>> print(e)
[[1]
[2]
[3]
[4]]
>>> e.shape
(4, 1)
>>> f = np.array([[[1], [2], [3], [4]]])
>>> print(f)
[[[1]
[2]
[3]
[4]]]
>>> f.shape
(1, 4, 1)
>>> g = np.array([[[1, 2], [2, 3], [3,4], [4, 5]]])
>>> print(g)
[[[1 2]
[2 3]
[3 4]
[4 5]]]
>>> g.shape
(1, 4, 2)
shape()
最新推荐文章于 2022-04-12 16:53:29 发布