Each of these methods returns a Tensor which is a sub-tensor of the given tensor, with the same Storage. Hence, any modification in the memory of the sub-tensor will have an impact on the primary tensor, and vice-versa.

These methods are very fast, and they do not involve any memory copy.


  1. [Tensor] narrow(dim, index, size)
  2. [Tensor] sub(dim1s, dim1e ... [, dim4s [, dim4e]])
  3. [Tensor] select(dim, index)