triu¶
dragon.vm.torch.
triu
(
input,
diagonal=0,
out=None
)[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 = torch.ones(3, 3) print(torch.triu(x))
- Parameters:
- input (dragon.vm.torch.Tensor) – The input tensor.
- diagonal (int, optional, default=0) – Diagonal below which to zero elements.
- out (dragon.vm.torch.Tensor, optional) – The output tensor.
- Returns:
dragon.vm.torch.Tensor – The output tensor.