Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 612 Bytes

File metadata and controls

30 lines (21 loc) · 612 Bytes

simplegrad

micrograd with tensors. Matmul, reshapes, broadcasting, sum etc. This is a toy project.

from simplegrad.engine import Value

# simplegrad supports tensors
a = Value([[[1,2], [3,4]], [[2,1], [4,3]]])
b = [-1, 1]

# matmul and broadcast semantics work
c = a @ b + b
d = 2 * c.relu()

# reshapes too
e = d.reshape((4,))

# call Value.backward() to backprop
e.grad = [1,2,3,4]
e.backward()

demo

demo.ipynb showcases how to build a model with simplegrad for the moon dataset. It's adapted from the micrograd demo.

decision boundary