Skip to content

Instantly share code, notes, and snippets.

View dipam7's full-sized avatar
🎯
Focusing

Dipam Vasani dipam7

🎯
Focusing
View GitHub Profile
@dipam7
dipam7 / mat_mul_3.py
Created November 16, 2019 03:34
MatMul3
m1 = x_valid[:5]
m2 = weights
m1.shape, m2.shape
%time t1 = matmul(m1, m2)
@dipam7
dipam7 / mat_mul_2.py
Created November 16, 2019 03:32
MatMul2
weights = torch.randn(784, 10)
bias = torch.zeros(10)
@dipam7
dipam7 / mat_mul_1.py
Created November 16, 2019 03:30
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
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5"
},
"outputs": [