Trilu

Description

Obtains 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 * indicates zero or more dimensions.

Input

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

k (optional): offset of the main diagonal. Supports only setting k to 0.

Attributes

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

Output

output: tensor of the identical data type and shape to input.

Constraints

k must be 0.

ONNX Opset Support

Opset v14/v15/v16/v17/v18