def loop

bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:231

import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
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

231def loop(fuel: Nat, +operation: Operation, +plan: Shape.BroadcastPlan, +cursor: Nat, state: State<Shape.output_shape(plan)>) ->
232  (Core.Dynamic & Core.Dynamic) & Result<&2, &1, Core.Error, Core.Dynamic>:
233  match fuel:
234    case 0n:
235      State{left, right, output} = state
236      ((left, right), Done{Core.pack(Shape.output_shape(plan), output)})
237    case 1n+remaining:
238      finish_step(Shape.output_shape(plan), cursor,
239        state => loop(remaining, operation, plan, 1n+cursor, state), natural_step(operation, plan, cursor, state))

Uses (13)

Used by (17)