def select_checked
bendtorch-core@0.1.0.0 · src/tensor/slice.bend:439
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
439def select_checked(+shape: Shape.Shape, tensor: Core.Tensor<shape>, +dim: U32, +index: U32, refused: Maybe<&2, Error>) ->
440 Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
441 match refused:
442 case Some{error}:
443 (Core.Packed{shape, tensor}, Fail{error})
444 case None{}:
445 select_ranged(shape, tensor, dim, index, Nat.is_lt(U32.to_nat(index), extent_at(Shape.dimensions(shape), dim)))