Operator function: Performs one_hot calculation on an input self whose length is n to obtain an output out whose number of elements is n x k. The value of k is numClasses. The output elements meet the following formula:
Example:
[object Object]
Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] is called to perform computation.
[object Object][object Object]
Parameters:
[object Object](aclTensor*, computation input): index tensor,[object Object]in the formula, aclTensor on the device. The shape supports one to eight dimensions. are supported. The can be ND.- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: The data type can be INT32 or INT64.
- numClasses (int, computation input): number of classes. The data type must be INT64. If
[object Object]is an empty tensor, the value of[object Object]must be greater than 0. If[object Object]is not an empty tensor, the value of[object Object]must be greater than or equal to 0. If the value of[object Object]is 0, an empty tensor is returned. If any element in[object Object]is greater than[object Object], these elements are encoded as all offValues. [object Object](aclTensor*, computation input): padding value at the index position,[object Object]in the formula, aclTensor on the device. The shape supports one to eight dimensions. Only the first element value is used for computation. The data type is the same as that of[object Object]. are supported. The can be ND.- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: The data type can be FLOAT16, FLOAT, INT32, or INT64.
[object Object](aclTensor*, computation input): padding value at a non-index position,[object Object]in the formula, aclTensor on the device. The shape supports one to eight dimensions. Only the first element value is used for computation. The data type is the same as that of[object Object]. are supported. The can be ND.- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: The data type can be FLOAT16, FLOAT, INT32, or INT64.
[object Object](int64_t, computation input): dimension to insert an encoding vector. The minimum value is -1, and the maximum value is the number of[object Object]dimensions. If the value is -1, the encoding vector is inserted into the last dimension of[object Object].[object Object](aclTensor*, computation output): One-hot tensor, output[object Object]in the formula, aclTensor on the device. The shape supports 1 to 8 dimensions and is the same as the shape after numClasses is inserted into the self shape on the axis. Non-contiguous tensors(../common/discontinuous tensor.md) are supported. can be ND.- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: The data type can be FLOAT16, FLOAT, INT32, or INT64.
[object Object](uint64_t*, output): size of the workspace to be allocated on the device.[object Object](aclOpExecutor**, output): operator executor, containing the operator computation process.
Returns:
[object Object]
Parameters:
[object Object](void*, input): address of the workspace to be allocated on the device.[object Object](uint64_t, input): size of the workspace to be allocated on the device, which is obtained by calling aclnnOneHotGetWorkspaceSize.[object Object](aclOpExecutor*, input): operator executor, containing the operator computation process.[object Object](aclrtStream, input): stream for executing the task.
Returns:
- Deterministic computing:
[object Object]defaults to a deterministic implementation.
- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
- When the data type of
[object Object]is INT64, the value of the first element can only be 0 or 1. - The size of the input self is selfSize, the size of the output out is outSize, and the size of the ub is ubSize. When the value of axis is 0, the following scenarios are not supported:
- selfSize 3 < ubSize - 16K < outSize 3 / 2
- When the data type of
The following example is for reference only. For details, see .
[object Object]