def select

bendtorch-core@0.1.0.0 · src/tensor/slice.bend:447

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

447# PyTorch's input.select(dim, index): the slice index:index + 1 at axis
448# `dim`, then a reshape that drops the axis, refused when the index is at or
449# past the extent.
450def select(input: Core.Dynamic, +dim: U32, +index: U32) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
451  Core.Packed{+shape, tensor} = input
452  select_checked(shape, tensor, dim, index, refusal(Shape.dimensions(shape), dim, 1))

Uses (8)

Used by (5)