def narrow_ranged

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

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

408def narrow_ranged(+shape: Shape.Shape, tensor: Core.Tensor<shape>, +dim: U32, +start: U32, +length: U32, fits: Bool) ->
409  Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
410  match fits:
411    case False{}:
412      (Core.Packed{shape, tensor}, Fail{OutOfRange{}})
413    case True{}:
414      slice(Core.Packed{shape, tensor}, dim, start, U32.add(start, length), 1)

Uses (11)

Used by (3)