This is the standard efficient algorithm for computing gradients in an MLP.

  1. Forward Pass: Move forward through the graph to compute all intermediate results and the final loss.
  2. Backward Pass: Move backward through the graph to compute gradients (partial derivatives) for every parameter, using from successor nodes.

Example