def delivered
bendtorch-core@0.1.0.0 · src/autograd/tensor_chain_PROOF.bend:183
import bendtorch-core@0.1.0.0/src/autograd/tensor_chain_PROOF.bend as TensorChainPROOF
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
import bendtorch-core@0.1.0.0/src/autograd/tensor_chain_LAWS.bend as Laws
183def delivered(items: Laws.Log(), state: Laws.Slots(), +count: Nat, -slots: List<&1, Gradient.Slot>, -log: Laws.Log(),
184 pushed: Pushed(state, slots, count, log)) -> Delivered<items, state, count, slots, log>:
185 match items state:
186 case Nil{} state:
187 Delivered{state, {==}, pushed}
188 case Con{Backward.Contribution{+target, +shape, gradient}, rest} Fail{error}:
189 Delivered{Fail{error}, {==}, Unit{}}
190 case Con{Backward.Contribution{+target, +shape, gradient}, rest} Done{pending}:
191 rebump(rest, count, target, shape, gradient, pending, slots, log,
192 bump_pulls(pending, count, target, shape, gradient, Backward.at_head(count, target), slots, log, pushed, {==}),
193 after => slots2 => log2 => pushed2 => delivered(rest, after, count, slots2, log2, pushed2))