law signed_slice_bounds
import bendtorch-core@0.1.0.0/src/tensor/signed_LAWS.bend as SignedLAWSimport Base
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/signed.bend as Signed
import bendtorch-core@0.1.0.0/src/tensor/slice.bend as Slice
346# A signed slice is the unsigned slice at the wrapped axis of the bounds of
347# its start and stop among that axis's extent; slice_LAWS.bend's clamp then
348# gives PyTorch's.
349law signed_slice_bounds:
350 for input: Core.Dynamic
351 for +dim: Signed.Position
352 for start: Signed.Position
353 for stop: Signed.Position
354 for +step: U32
355 {Signed.slice(input, dim, start, stop, step) ==
356 Slice.slice(input, axis_of(input, dim), Signed.bound(extent_of(input, axis_of(input, dim)), start),
357 Signed.bound(extent_of(input, axis_of(input, dim)), stop), step) :
358 Core.Dynamic & Result<&2, &1, Slice.Error, Core.Dynamic>}
Uses (11)
Used by (0)
No other definition uses this definition.