def narrow

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

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

425# PyTorch's input.narrow(dim, start, length): the slice start:start + length
426# at axis `dim`, refused when start + length passes the extent.
427def narrow(input: Core.Dynamic, +dim: U32, +start: U32, +length: U32) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
428  Core.Packed{+shape, tensor} = input
429  narrow_checked(shape, tensor, dim, start, length, refusal(Shape.dimensions(shape), dim, 1))

Uses (8)

Used by (6)