mindspore.numpy.tril
- mindspore.numpy.tril(m, k=0)[源代码]
Returns a lower triangle of a tensor.
Returns a copy of a tensor with elements above the k-th diagonal zeroed.
- Parameters
- Returns
Lower triangle of m, of same shape and data-type as m.
- Supported Platforms:
Ascend
GPU
CPU
- Raises
TypeError – If input arguments have types not specified above.
ValueError – If input m’s rank \(< 1\).
Examples
>>> import mindspore.numpy as np >>> output = np.tril(np.ones((3, 3))) >>> print(output) [[1. 0. 0.] [1. 1. 0.] [1. 1. 1.]]