def row_major

bendtorch-core@0.1.0.0 · src/shape/core.bend:166

import bendtorch-core@0.1.0.0/src/shape/core.bend as Core
import Base

166def row_major(+dims: List<&2, Nat>, coordinate: Coordinate(dims)) -> Nat:
167  match dims:
168    case Nil{}:
169      0n
170    case +head <> +tail:
171      CStep{index, rest} = coordinate
172      Nat.add(Nat.mul(Fin.value(head, index), numel(tail)), row_major(tail, rest))

Uses (8)

Used by (19)