def select_ranged
bendtorch-core@0.1.0.0 · src/tensor/slice.bend:431
import bendtorch-core@0.1.0.0/src/tensor/slice.bend as Slice
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
431def select_ranged(+shape: Shape.Shape, tensor: Core.Tensor<shape>, +dim: U32, +index: U32, below: Bool) ->
432 Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
433 match below:
434 case False{}:
435 (Core.Packed{shape, tensor}, Fail{OutOfRange{}})
436 case True{}:
437 reshaped(dropped(Shape.dimensions(shape), U32.to_nat(dim)), slice(Core.Packed{shape, tensor}, dim, index, U32.add(index, 1), 1))