Rate this Page

Function torch ::stable::narrow#

Function Documentation#

inline torch::stable::Tensor torch::stable::narrow(torch::stable::Tensor &self, int64_t dim, int64_t start, int64_t length)#

Stable version of the narrow.default op.

Returns a new tensor that is a narrowed version of the input tensor. The dimension dim is narrowed from start to start + length.

Minimum compatible version: PyTorch 2.9.

Note

The start and length parameters is not yet header-only.

Parameters:
  • self – The input tensor to narrow.

  • dim – The dimension along which to narrow.

  • start – The starting index for the narrowed dimension.

  • length – The length of the narrowed dimension.

Returns:

A new tensor that is a narrowed view of the input.