This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/nn_adjoints

The backward passes of lib/nn, written by hand

Before Viv had value_and_grad, each piece of lib/nn came with a backward pass written by hand: given the gradient of the loss with respect to the piece's output, the gradients with respect to its inputs and weights. Model code no longer uses them; value_and_grad generates the same gradients from the forward pass. They are kept here as references. The tests below hold each one to the gradient value_and_grad generates, and the study/idioms ports that write their backward pass by hand, to compare it with the generated one, call them.

Used with import nn_adjoints.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 17–141