vt::triu#

template<typename T>
Tensor<T, 2> vt::triu(const Tensor<T, 2> &tensor, int k = 0, bool copy = true)#

Return an upper triangle of the 2D tensor.

Template Parameters:

T – Data type of the tensor.

Parameters:
  • tensor – The input tensor

  • k – An offset for the diagonal below which to zero elements.

  • copy – If false, the operation is performed in-place.

Returns:

Tensor: The result tensor.

template<typename T, size_t N>
Tensor<T, N> vt::triu(const Tensor<T, N> &tensor, int k = 0)#

Return an upper triangle of the tensor.

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

  • N – Number of dimensions of the tensor.

Parameters:
  • tensor – The input tensor

  • k – An offset for the diagonal below which to zero elements.

Returns:

Tensor: The result tensor.