Signed.slice: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/signed.bend as Signed Lines 310-318 of bendtorch-core@0.1.0.0/src/tensor/signed.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/signed.bend&start_line=310&end_line=318 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core import bendtorch-core@0.1.0.0/src/tensor/slice.bend as Slice # PyTorch's input[..., start:stop:step, ...] with the slice at a signed axis # `dim`, wrapped among the rank, and signed start and stop: the unsigned # slice of the bounds. A rank-0 input has no axis, so every dim is refused. def slice(input: Core.Dynamic, dim: Position, start: Position, stop: Position, +step: U32) -> Core.Dynamic & Result<&2, &1, Slice.Error, Core.Dynamic>: Core.Packed{+shape, tensor} = input +axis = wrap(Shape.rank(shape), dim) +n = extent(Shape.dimensions(shape), axis) Slice.slice(Core.Packed{shape, tensor}, axis, bound(n, start), bound(n, stop), step) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=dimensions https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=rank https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Dynamic https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/signed.bend&name=Position https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/signed.bend&name=bound https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/signed.bend&name=extent https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/signed.bend&name=wrap https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/slice.bend&name=Error https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/slice.bend&name=slice