Difference between numpy dot() and Python 3.5+ matrix multiplication @
问题 I recently moved to Python 3.5 and noticed the new matrix multiplication operator (@) sometimes behaves differently from the numpy dot operator. In example, for 3d arrays: import numpy as np a = np.random.rand(8,13,13) b = np.random.rand(8,13,13) c = a @ b # Python 3.5+ d = np.dot(a, b) The @ operator returns an array of shape: c.shape (8, 13, 13) while the np.dot() function returns: d.shape (8, 13, 8, 13) How can I reproduce the same result with numpy dot? Are there any other significant