【发布时间】:2021-07-23 14:45:44
【问题描述】:
我试图将两个 Numpy 数组相乘,但我收到了与广播相关的错误-
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-124-6e9219ae5e45> in <module>
----> 1 d=B*C.reshape(-1,1)
ValueError: operands could not be broadcast together with shapes (3,5,7) (3,1)
我的数组是-
B=np.random.rand(5,7,3).T.swapaxes(2,1)
C=np.linspace(1,5,3)
d=B*C.reshape(-1,1)
您能否解释一下这是什么错误以及我应该做什么? 谢谢
【问题讨论】:
标签: python numpy array-broadcasting