OneHot
Description
Performs one_hot calculation on an input tensor whose length is n to obtain an output tensor whose size is n x k. The value of k is numClasses.

Input
- indices: input tensor of type int32.
- on_value: data type consistent with the output, indicating the activated value in one-hot encoding.
- off_value: data type consistent with the output, indicating the deactivated value in one-hot encoding.
Property
- axis (optional): int64, indicating the axis of the operator.
- depth: int64, depth of one-hot encoding (number of classes).
Output
y: output tensor of the identical data type to the input values.
Constraints
- axis must not be less than –1.
- depth >= 1
- When the output is of type int64, the range of 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
Parent topic: Supported ONNX Operators