-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: @ operator differs from the convention for tensor dot #26438
Comments
See numpy.vecdot. Of course that doesn't help someone wanting to use |
Changing/adding operators in Python will not be easy, matmul was one of the few things that happened. |
Also see np.einsum, which lets you write the contraction you want explicitly using Einstein notation. Closing since there's nothing really numpy can do to add more operators to Python and the operation the reporter was looking for is possible with a different spelling. |
Describe the issue:
Hi, the current$A$ or $B$ is multi-dimensional, $C_{ijm} = \sum_{k} A_{ijk} B_{ikm}$ . However, for multi-dimensional array, is would be more convenient and intuitive if it can somewhat imitate the behavior of tensor dots like using $C_{ij} = \sum_{m,n} A_{imn} B_{nmj}$ . Is it possible to overload functions for such
@
operator hasnp.matmul
function underlying, which means ifC = A@B
is equivalent toC = A@@B
to calculate@@@...
operators?Reproduce the code example:
Error message:
No response
Python and NumPy Versions:
1.26.4
3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
Runtime Environment:
No response
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: