def copy_loop
bendtorch-core@0.1.0.0 · src/tensor/transforms.bend:163
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
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/tensor/layout.bend as Layout
163def copy_loop(fuel: Nat, +input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>,
164 source: Core.Tensor<input>, target: Core.Tensor<Layout.output(input, axes, plan)>, +cursor: Nat) ->
165 Core.Tensor<input> & Result<&2, &1, Error, Core.Tensor<Layout.output(input, axes, plan)>>:
166 match fuel:
167 case 0n:
168 (source, Done{target})
169 case 1n+p:
170 natural_next(input, axes, plan, cursor,
171 source => target => copy_loop(p, input, axes, plan, source, target, 1n+cursor),
172 natural_step(input, axes, plan, cursor, source, target))