Last active
January 31, 2022 09:00
-
-
Save jgalazm/39ba12750d9106f040ad99c8533a15ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialice using indices from the right-hand-side | |
C = np.zeros(A.shape[0], A.shape[-1], B.shape[0], B.shape[1], B.shape[3]) | |
for p in A.shape[0]: | |
for s in A.shape[-1]: | |
for t in B.shape[0]: | |
for u in B.shape[1]: | |
for v in B.shape[3]: | |
# now perform the sum using indices from the LHS that did | |
# not show on the RHS | |
for q in range(A.shape[1]): | |
for r in range(A.shape[2]): | |
C[p,s,t,u,v] += A[p,q,r,s]*B[t,u,q,r,v] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment