def fill_values
bendtorch-core@0.1.0.0 · src/tensor/core.bend:376
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
376def fill_values(values: List<&2, F32>, -shape: Shape.Shape, tensor: Tensor<shape>, +cursor: Nat) ->
377 Result<&2, &1, Error, Tensor<shape>>:
378 match values:
379 case Nil{}:
380 Done{tensor}
381 case value <> rest:
382 +index = U32.from_nat(cursor)
383 fill_values_decided(shape, cursor, index, value, tensor,
384 tensor => fill_values(rest, shape, tensor, 1n+cursor), Shape.bool_case(Nat.is_eq(U32.to_nat(index), cursor)))