def fired

bendtorch-core@0.1.0.0 · src/autograd/tensor_chain_LAWS.bend:94

import bendtorch-core@0.1.0.0/src/autograd/tensor_chain_LAWS.bend as TensorChainLAWS
import Base
import bendtorch-core@0.1.0.0/src/autograd/gradient.bend as Gradient
import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as Backward

94# An entry that holds g after gathering: its VJP's contributions join the log
95# in operand order, so the first operand's arrives first.
96def fired(pass: Backward.Pass, log: Log(), rec: Log() -> Slots()) -> Slots():
97  Backward.Pass{saved, g, contributions} = pass
98  match contributions:
99    case Fail{error}:
100      Fail{error}
101    case Done{items}:
102      Backward.prepend(Gradient.Slot, Gradient.Held{g}, rec(List.reverse.go(&1, Backward.Contribution, items, log)))

Uses (8)

Used by (2)