Trilu

Description

Obtain the upper or lower triangular part of a two-dimensional matrix or a batch of two-dimensional matrices. That is, the shape of the input Tensor is [*, N, M], where * represents zero or more dimensions.

Input

input: input tensor of type uint8, int8, int16, int32, bool, float, float16, float64, or int64, with shape [*, N, M].

k: (optional) data type: specifies the offset from the main diagonal. Only k = 0 is supported.

Output

One output:

y: tensor of type float16, float32, or double.

Property

upper: bool

If True, the upper triangular part is retained. If False, retain the lower triangular part.

Constraints

k=0 is a hard constraint.

ONNX Opset Support

Opset v14/v15/v16/v17/v18