def sum_to
import bendtorch@1.3.0.0/tensor.bend as Tensorimport Base
256# g + (dz summed down to a's shape): the gradient of an operand that was broadcast from a to o; dz comes back
257def sum_to(+a: List<&2, Nat>, +o: List<&2, Nat>, dz: Tensor<o>, g: Tensor<a>) -> TP<o, a>:
258 match dz g:
259 case Tensor{d} Tensor{e}:
260 tp_of(o, a, scatter_l(numel(o), 0, bmap(a, o), Array.get(F32, d, 0), Array.get(F32, e, imap(bmap(a, o), 0))))
Uses (11)
Used by (0)
No other definition uses this definition.