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
86
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{}