def zero_left

bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:287

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

287# Whether the left input's stride is 0 on every axis, as for a rank-0
288# input, so that every position walks to slot 0.
289def zero_left(rows: List<&2, Shape.Row>) -> Bool:
290  match rows:
291    case Shape.Row{stride, +left, right} <> rest:
292      Bool.and(Nat.is_eq(left, 0n), zero_left(rest))
293    case Nil{}:
294      True{}

Uses (5)

Used by (4)