def bound

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

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

299# PyTorch's slice positions (aten::slice, get_slice_bounds) before its clamp
300# to the axis: a negative position d becomes d + limit, the wrap, and one
301# still below 0 becomes 0. First{k} stays k; Slice.bounds then clamps both
302# ends to the extent.
303def bound(+limit: U32, +position: Position) -> U32:
304  Bool.pick(U32, before(limit, position), 0, wrap(limit, position))

Uses (5)

Used by (7)