triu¶
dragon.
triu
(
inputs,
k=0,
copy=True,
**kwargs
)[source]¶Return the upper triangular part of input.
\[\text{out}_{ij} = \begin{cases} 0, & \text{ if } j < i + k \\ \text{input}_{ij}, & \text{ otherwise } \end{cases} \]Examples:
x = dragon.ones((3, 3)) print(dragon.triu(x))
- Parameters:
- inputs (dragon.Tensor) – The input tensor.
- k (int, optional, default=0) – Diagonal below which to zero elements.
- copy (bool, optional, default=True) – Return a new tensor or call in-place.
- Returns:
dragon.Tensor – The output tensor.