mirror of
https://github.com/numpy/numpy.git
synced 2026-10-28 16:34:42 +08:00
When a.ndim >= 2 and b.ndim > 2, np.dot() and ndarray.dot() place b's leading dimensions in the middle of the result: a = np.ones((2, 3)) b = np.ones((4, 3, 5)) np.dot(a, b).shape # (2, 4, 5) - the 4 ends up in the middle @/matmul gives (4, 2, 5). This PR deprecates the dot behavior for these inputs and suggests numpy.tensordot(a, b, axes=[-1, -2]) for the same result, or @/matmul for batched matrix multiplication.