def step_contribution

bendtorch-core@0.1.0.0 · src/autograd/gradient.bend:53

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

53def step_contribution(-shape: Shape.Shape, +index: U32, total: Core.Tensor<shape>,
54  pair: Core.Dynamic & Result<&2, &2, Core.Error, F32>) -> Step<shape>:
55  (contribution, result) = pair
56  match result:
57    case Fail{error}:
58      Stop{contribution, total, error}
59    case Done{value}:
60      step_total(shape, index, contribution, value, Core.read_flat(shape, total, index))

Uses (12)

Used by (5)