EyeLike

Description

Generates a 2D matrix with the main diagonal of 1 and other values of 0.

Input

One input:

x: 2-dimensional tensor, used to copy the shape of the tensor.

Output

One output:

y: tensor with the same shape as input x.

Attribute

dtype: int, output data type. For details, see https://onnx.ai/onnx/api/mapping.html.

k: int, specifying the index of the diagonal to be populated with ones. Defaults to 0. If y is the output, y[i, i+k] = 1.

Constraints

Only k=0 is supported.

ONNX Opset Support

Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18