mindspore.Tensor.triu

Tensor.triu(diagonal=0)[source]

Returns a triangular matrix based on the diagonal. Default is the main diagonal.

Parameters

diagonal (int) – The index of diagonal. Default: 0.

Returns

Tensor, a tensor has the same shape and data type as input.

Raises
Supported Platforms:

GPU CPU