Created
November 16, 2019 03:30
-
-
Save dipam7/637fd848e19cdd6a1d27b9b440d92382 to your computer and use it in GitHub Desktop.
MatMul1
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
def matmul(a,b): | |
ar, ac = a.shape | |
br, bc = b.shape | |
assert ac == br | |
c = torch.zeros(ar, bc) | |
for i in range(ar): | |
for j in range(bc): | |
for k in range(ac): | |
c[i,j] += a[i,k] * b[k,j] | |
return c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment