/toydiff

Toy autodiff implementation in Nim using a tape

Primary LanguageNimMIT LicenseMIT

Toydiff: Nim simple autodiff

This code is just for educational purposes and not meant to be practical in any way. There are plenty of good autodiff libraries out there that you can use for actual projects like Tensorflow, Pytorch, Jax, or Arraymancer.

It is based on the following blog post: https://rufflewind.com/2016-12-30/reverse-mode-automatic-differentiation. There's also a similar archived project by the creator of Arraymancer in Nim.

At the time of writing the current stable Nim branch is 1.6.

To compile toydiff.nim, do:

nim cbuild src/toydiff.nim

To run the tests, use:

testament pattern tests/*