def total_owner

bendtorch-core@0.1.0.0 · src/autograd/gradient_PROOF.bend:172

import bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend as GradientPROOF
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

172def total_owner(-shape: Shape.Shape, +index: U32, -contribution: Core.Dynamic, +value: F32,
173  pair: Core.Tensor<shape> & Result<&2, &2, Core.Error, F32>) ->
174  Holds<{step_owner(shape, Gradient.step_total(shape, index, contribution, value, pair)) == contribution : Core.Dynamic}>:
175  (total, result) = pair
176  match result:
177    case Fail{error}:
178      Holds{{==}}
179    case Done{+accumulated}:
180      write_owner(shape, contribution, Core.write_flat(shape, total, index, F32.add(accumulated, value)))

Uses (15)

Used by (1)