def read_step
bendtorch-core@0.1.0.0 · src/tensor/reduction.bend:18
import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reduction
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
18def read_step(-shape: Shape.Shape,
19 rec: Core.Tensor<shape> -> F32 -> Result<&2, &1, Core.Error, Core.Tensor<shape> & F32>,
20 accumulator: F32, pair: Core.Tensor<shape> & Result<&2, &2, Core.Error, F32>) ->
21 Result<&2, &1, Core.Error, Core.Tensor<shape> & F32>:
22 (tensor, result) = pair
23 match result:
24 case Fail{error}:
25 Fail{error}
26 case Done{value}:
27 rec(tensor, F32.add(accumulator, value))