def total_over

bendtorch-core@0.1.0.0 · src/autograd/loss.bend:184

import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Loss
import Base
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reduction

184# The sum of every word, in ascending flat order from +0.0
185# (Reduction.sum_dynamic), divided by `count`: a rank-0 tensor.
186def total_over(+count: Nat, result: Result<&2, &1, Core.Error, Core.Dynamic & Core.Dynamic>) -> Result<&2, &1, Core.Error, Core.Dynamic>:
187  match result:
188    case Fail{error}:
189      Fail{error}
190    case Done{pair}:
191      divided_by(count, pair, Core.new(Reduction.scalar_shape(), count_f32(count)))

Uses (9)

Used by (2)