def relay

bendtorch-core@0.1.0.0 · src/autograd/tensor_chain_PROOF.bend:162

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/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
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

162def relay(-rest: Laws.Log(), +count: Nat, +target: Nat, +shape: Shape.Shape, -gradient: Core.Dynamic, -pending: List<&1, Gradient.Slot>,
163  -slots: List<&1, Gradient.Slot>, -log: Laws.Log(), -state: Laws.Slots(),
164  bumped: {state == Backward.bump(pending, count, target, shape, gradient, Backward.at_head(count, target)) : Laws.Slots()},
165  out: Delivered<rest, state, count, slots, Backward.Contribution{target, shape, gradient} <> log>) ->
166  Delivered<Backward.Contribution{target, shape, gradient} <> rest, Done{pending}, count, slots, log>:
167  Delivered{after, delivered, pushed} = out
168  Delivered{after, Equal.trans(Laws.Slots(), after, Backward.deliver(rest, count, state),
169    Backward.deliver(rest, count, Backward.bump(pending, count, target, shape, gradient, Backward.at_head(count, target))), delivered,
170    Equal.cong(Laws.Slots(), Laws.Slots(), result => Backward.deliver(rest, count, result), state,
171      Backward.bump(pending, count, target, shape, gradient, Backward.at_head(count, target)), bumped)), pushed}

Uses (15)

Used by (1)