MicrogradEx.Value.Edge (MicrogradEx v0.1.0)

Copy Markdown View Source

A single local derivative from one operation output back to one parent value.

In the Python version each Value stores a _backward closure that mutates its parents. This struct is the functional replacement for those closures. An edge says:

d(output) / d(parent) = local_gradient

During backpropagation we multiply that local gradient by the gradient that has already reached the output node. That is the chain rule in one line.

Summary

Types

t()

@type t() :: %MicrogradEx.Value.Edge{
  local_gradient: float(),
  parent_id: pos_integer()
}