def single_rows

bendtorch-core@0.1.0.0 · src/autograd/reduce.bend:85

import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape

85# Whether every row here takes one digit (span 1), so that the fiber below
86# a digit of the row above is one word.
87def single_rows(+rows: List<&2, Shape.Row>, +extents: List<&2, Nat>) -> Bool:
88  match rows extents:
89    case Nil{} _:
90      True{}
91    case Shape.Row{stride, +left, right} <> +rest +extent <> +others:
92      Bool.and(Nat.is_eq(span(left, extent), 1n), single_rows(rest, others))
93    case Shape.Row{stride, left, right} <> rest Nil{}:
94      False{}

Uses (7)

Used by (9)