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.ipynb showcases how to build a model with simplegrad for the moon dataset.
It's adapted from the micrograd demo.
