Operator function: implements the backward computation of and accumulates the gradient row corresponding to the same index [object Object] to out.
Each operator has calls. First, aclnnEmbeddingDenseBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation flow. Then, aclnnEmbeddingDenseBackward is called to perform computation.
[object Object][object Object]
Parameters
- grad (aclTensor*, compute input): original gradient of the data, aclTensor on the device. The shape supports 2 to 8 dimensions. The shape after axis combination is the same as that after axis combination of indices except the last axis. are supported. The can be ND.
- [object Object]Atlas training products[object Object]: The data type can be FLOAT16 or FLOAT.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], and Ascend 950PR/Ascend 950DT: The data type can be BFLOAT16, FLOAT16, or FLOAT.
- indices (aclTensor*, compute input): index value corresponding to the grad input. It is an aclTensor on the device. The value range is [0, numWeights). The number of dimensions ranges from 1 to 8. are supported. The supports ND. The data type can be FLOAT, FLOAT16, DOUBLE, INT32, INT64, INT16, INT8, UINT8, or BOOL.
- numWeights (uint64_t, compute input): size of the first axis of the output tensor.
- paddingIdx (uint64_t, compute input): used to pad 0 to the paddingIdx row in the output tensor. If paddingIdx is a negative number, no processing is performed.
- scaleGradByFreq (bool, input): whether to scale the gradient based on the frequency of word occurrence. If the value is true, the result is scaled by word frequency. If the value is false, no processing is performed.
- out (aclTensor*, compute output): output result of gradient summation, aclTensor on the device. The shape has 2 dimensions. The size of the first axis is numWeights, and the size of the last axis is the same as that of the last axis of grad. The data type must be the same as that of grad. The can be ND.
- [object Object]Atlas training products[object Object]: The data type can be FLOAT16 or FLOAT.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], and Ascend 950PR/Ascend 950DT: The data type can be BFLOAT16, FLOAT16, or FLOAT.
[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.
- grad (aclTensor*, compute input): original gradient of the data, aclTensor on the device. The shape supports 2 to 8 dimensions. The shape after axis combination is the same as that after axis combination of indices except the last axis. are supported. The can be ND.
Returns
[object Object]: status code. For details, see .[object Object]
Parameters
[object Object](void*, input): address of the workspace to be allocated on the device.- workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by calling aclnnEmbeddingDenseBackwardGetWorkspaceSize.
[object Object](aclOpExecutor *, input): operator executor, containing the operator computation process.[object Object](aclrtStream, input): stream for executing the task.
Returns
- [object Object]Atlas training products[object Object]:
- If scale is set to true, the last dimension of grad is defined as embeddingDim. An error is reported when its size exceeds the specified range. The valid ranges are as follows:
- When indices is INT32, the following condition must be satisfied:
- When indices is INT64, the following condition must be satisfied:
- The formula for countsSize is as follows, where coreNum indicates the number of AI processor cores:
- If scale is set to true, the last dimension of grad is defined as embeddingDim. An error is reported when its size exceeds the specified range. The valid ranges are as follows:
- [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 parameter shape exceeds the following limits, high precision cannot be guaranteed. If deterministic computation is enabled, high performance cannot be guaranteed either.
- After grad is collapsed to a 2D shape, the first dimension exceeds INT32_MAX (2147483647).
- numWeights exceeds INT32_MAX (2147483647).
- When the collapsed dimension of indices exceeds INT32_INF (2139095040), high performance cannot be guaranteed.
- When the parameter shape exceeds the following limits, high precision cannot be guaranteed. If deterministic computation is enabled, high performance cannot be guaranteed either.
The following example is for reference only. For details, see .
[object Object]