Skip to content

NavneetKanna/dlgrad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dlgrad

dlgrad (Deep Learning autograd): A Lightweight Autograd Engine for Deep Learning

Inspired by Andrej Karpathy's micrograd and George Hotz's tinygrad, dlgrad is my personal exploration into building an Autograd engine from scratch. Its lightweight in design and has PyTorch like API.

Features

  • CPU and GPU Support: The library currently supports both CPU and GPU (Metal) backends.

Internals

You can read my blog to learn more about how dlgrad operates.

Examples

from dlgrad.tensor import Tensor

# Create tensors filled with random numbers from a uniform distribution
a = Tensor.rand(10, 10)
b = Tensor.rand(10, 10)
# Since the tensors are c buffers, use numpy to print
print(a.numpy())
print(b.numpy())

c = Tensor.add(a, b)
print(c.numpy())