def same_left
bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:266
import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
266
267
268
269def same_left(rows: List<&2, Shape.Row>) -> Bool:
270 match rows:
271 case Shape.Row{+stride, +left, right} <> Nil{}:
272 Bool.and(Nat.is_eq(stride, 1n), Nat.is_eq(left, 1n))
273 case Shape.Row{+stride, +left, right} <> rest:
274 Bool.and(Nat.is_eq(left, stride), same_left(rest))
275 case Nil{}:
276 False{}