Skip to content

thomas-gale/micrograd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔥Micrograd 🔥

Attempting to follow Andrej Karpathy's wonderful tutorial and implement micrograd in mojo.

Notes

  • The Value uses reference semantics.
  • The Value's internal data, grad and _prev use a custom and very basic RC (reference counting pointer) - this will be migrated to references (and lifetimes) once they are ready in the core language.
  • Using traits to make Value a generic struct (we introduce a trait called Gradable which is basically a type constraint on what is needed on an 'autogradable' type which can be wrapped by our Value).
  • Gradable implementations:
    • GradFloat32
    • GradTensorFloat32
  • The topological sort in _backward is using an iterative implementation (nested functions don't currently support recursion)
  • Primitive test suite (make test) (including tests that mimic those of micrograd)

Dev setup