OneHot

Description

Generates a one-hot encoding tensor based on the input.

Input

Three inputs:

indices: tensor of type int32 or int64.

depth: tensor of type int32 or int64.

values: tensor of type int32, int64, float16, or float.

Output

One output:

y: tensor of the identical data type as the values input.

Property

axis: (optional) axis to which the one-hot representation is added.

Constraints

The operator attribute does not support axis<-1.

When the output is int64, the last input value is [0,1], where 1 indicates on_value and 0 indicates off_value.

ONNX Opset Support

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