def same_right
bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:278
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
278def same_right(rows: List<&2, Shape.Row>) -> Bool:
279 match rows:
280 case Shape.Row{+stride, left, +right} <> Nil{}:
281 Bool.and(Nat.is_eq(stride, 1n), Nat.is_eq(right, 1n))
282 case Shape.Row{+stride, left, +right} <> rest:
283 Bool.and(Nat.is_eq(right, stride), same_right(rest))
284 case Nil{}:
285 False{}