def numel_words

bendtorch-core@0.1.0.0 · src/shape/core.bend:392

import bendtorch-core@0.1.0.0/src/shape/core.bend as Core
import Base

392# numel_words, horner and digits_words run on checked coordinates or below a
393# nonzero element count only: every extent is then at least 1, so each product
394# is at most the shape's element count.
395def numel_words(dims: List<&2, U32>) -> Nat:
396  match dims:
397    case Nil{}:
398      1n
399    case head <> tail:
400      Nat.mul(U32.to_nat(head), numel_words(tail))

Uses (5)

Used by (5)