def flatten

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

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

147def flatten(+dims: List<&2, Nat>, coordinate: Coordinate(dims)) -> Fin(numel(dims)):
148  match dims:
149    case Nil{}:
150      FZero{}
151    case +head <> +tail:
152      CStep{index, rest} = coordinate
153      Fin.pack(head, numel(tail), (index, flatten(tail, rest)))

Uses (9)

Used by (11)