Hello all,

Can an m x n x k matrix be multiplied with n x k matrix? Looking at the
Numpy doc page 46 (
https://docs.scipy.org/doc/numpy-1.11.0/numpy-user-1.11.0.pdf), it should
work.

It says the following:
A (3d array): 15 x 3 x 5
B (2d array):         3 x 5
Result (3d array): 15 x 3 x 5

But, the rule did not work for me. Here's my toy example:
>>> a = np.arange(3*4*5).reshape(3,4,5)
>>> b = np.arange(4*5).reshape(4,5)
>>> np.dot(a, b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: shapes (3,4,5) and (3,5) not aligned: 5 (dim 2) != 3 (dim 0)

Am I miss reading something? Thank you in advance!
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to