Function burn::tensor::narrow

pub fn narrow<B, const D: usize, K>(
    tensor: <K as TensorKind<B>>::Primitive<D>,
    dim: usize,
    start: usize,
    length: usize,
) -> <K as TensorKind<B>>::Primitive<D>
where B: Backend, K: TensorKind<B> + BasicOps<B>,
Expand description

Returns a new tensor with the given dimension narrowed to the given range.

§Arguments

  • tensor - The tensor.
  • dim - The dimension along which the tensor will be narrowed.
  • start - The starting point of the given range.
  • length - The ending point of the given range.

§Panics

  • If the dimension is greater than the number of dimensions of the tensor.
  • If the given range exceeds the number of elements on the given dimension.

§Returns

A new tensor with the given dimension narrowed to the given range.