>>> import numpy as np
>>> A = np.zeros((12,2))
>>> B = np.zeros((12,))
>>> A
array([[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.]])
>>> B
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
>>> C = np.array([A, B], dtype=object)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not broadcast input array from shape (12,2) into shape (12)
>>> A = np.zeros((20,2))
>>> B = np.zeros((12,))
>>> C = np.array([A, B], dtype=object)
>>> C
array([array([[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.]]),
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])],
dtype=object)
(12,2)
和
(12,)