Skip to content

Instantly share code, notes, and snippets.

@dipam7
Created November 16, 2019 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dipam7/637fd848e19cdd6a1d27b9b440d92382 to your computer and use it in GitHub Desktop.
Save dipam7/637fd848e19cdd6a1d27b9b440d92382 to your computer and use it in GitHub Desktop.
MatMul1
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