vt::ascontiguoustensor#

template<typename T, size_t N>
Tensor<T, N> vt::ascontiguoustensor(const Tensor<T, N> &tensor)#

Convert the tensor to a contiguous tensor. If the tensor is not contiguous, it will copy and return a new tensor. Otherwise, it will return the same tensor.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

Parameters:

tensor – The tensor object.

Returns:

Tensor: The contiguous tensor object.