mindspore.numpy.triu_indices
- mindspore.numpy.triu_indices(n, k=0, m=None)[源代码]
Returns the indices for the upper-triangle of an (n, m) array.
- 参数
- 返回
The indices for the triangle. The returned tuple contains two tensors, each with the indices along one dimension of the tensor.
- 异常
TypeError – If n, k, m are not numbers.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> print(np.triu_indices(3)) (Tensor(shape=[6], dtype=Int32, value= [0, 0, 0, 1, 1, 2]), Tensor(shape=[6], dtype=Int32, value= [0, 1, 2, 1, 2, 2]))