def inside

bendtorch-core@0.1.0.0 · src/tensor/signed.bend:61

import bendtorch-core@0.1.0.0/src/tensor/signed.bend as Signed
import Base

61# Whether a position lies in PyTorch's range -limit..limit-1. Last{k} is
62# -1 - k, at least -limit exactly when k < limit.
63def inside(+limit: U32, position: Position) -> Bool:
64  match position:
65    case First{k}:
66      U32.is_lt(k, limit)
67    case Last{k}:
68      U32.is_lt(k, limit)

Uses (4)

Used by (3)