Reduce.single_rows: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce Lines 85-94 of bendtorch-core@0.1.0.0/src/autograd/reduce.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/autograd/reduce.bend&start_line=85&end_line=94 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape # Whether every row here takes one digit (span 1), so that the fiber below # a digit of the row above is one word. def single_rows(+rows: List<&2, Shape.Row>, +extents: List<&2, Nat>) -> Bool: match rows extents: case Nil{} _: True{} case Shape.Row{stride, +left, right} <> +rest +extent <> +others: Bool.and(Nat.is_eq(span(left, extent), 1n), single_rows(rest, others)) case Shape.Row{stride, left, right} <> rest Nil{}: False{} Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_eq https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/reduce.bend&name=span https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=Row