def gather
bendtorch-core@0.1.0.0 · src/autograd/tensor_chain_LAWS.bend:82
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
82
83
84
85def gather(slots: List<&1, Gradient.Slot>, +count: Nat, log: Log()) -> Slots():
86 match slots count:
87 case Nil{} count:
88 Done{Nil{}}
89 case Con{slot, rest} 0n:
90 Done{slot <> rest}
91 case Con{slot, rest} 1n+below:
92 gather_step(take(log, below, slot), more => gather(rest, below, more))