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
TypeError – If diagonal is not an int.
TypeError – If x is not an Tensor.
ValueError – If length of shape of x is less than 1.
- Supported Platforms:
GPU
CPU