def step_write

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

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

35def step_write(-shape: Shape.Shape, contribution: Core.Dynamic,
36  pair: Core.Tensor<shape> & Result<&2, &2, Core.Error, Unit>) -> Step<shape>:
37  (total, result) = pair
38  match result:
39    case Fail{error}:
40      Stop{contribution, total, error}
41    case Done{unit}:
42      Continue{State{contribution, total}}

Uses (10)

Used by (4)