- Description: Performs the backpropagation of
[object Object]. - Formula:
- When
[object Object]is not set to[object Object]:
When
[object Object]is set to[object Object]:When
[object Object]is set to[object Object]:If
[object Object]is set to[object Object]:
- When
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): aclTensor on the device. It is the gradient of the forward output[object Object], and the value is a 2D tensor. In drop/pad-less mode, the shape must be 2D with size (tokens_num * topK_num, hidden_size). In drop/pad mode, the shape must be a 2D with size (experts_num * capacity, hidden_size).[object Object]indicates the number of experts selected for each token, and[object Object]indicates the number of tokens selected by each expert. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The must be ND. are supported, but empty tensors are not supported.[object Object](aclTensor*, computation input): aclTensor on the device. This input is optional. If it is not passed,[object Object]does not need to be computed. In drop/pad-less mode, the shape must be 1D with size (tokens_num * topK_num). In drop/pad mode, the shape must be 1D with size (experts_num * capacity).[object Object]indicates the number of experts selected for each token, and[object Object]indicates the number of tokens selected by each expert. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The must be ND. are supported.[object Object](aclTensor*, input): aclTensor on the device. In drop/pad-less mode, the value must be a 1D shape with size (tokens_num * topK_num,). The data type can be INT32. The must be ND. The index value range is [0, tokens_num * topK_num – 1]. In drop/pad mode, the value must be a 1D tensor with shape (experts_num * capacity). The data type can be INT32. The must be ND. The index value range is [0, experts_num * capacity – 1]. are supported.[object Object](aclTensor*, computation input): aclTensor on the device, which indicates the mapping between tokens and experts, that is,[object Object]in the formula. The value must be a 2D shape with size (tokens_num, experts_num). The data type can be INT8 or BOOL. If the data type is INT8, the value can be[object Object]or[object Object]. If the data type is BOOL, the value can be[object Object]or[object Object]. The must be ND. are supported. In drop/pad-less mode, each row must contain topK[object Object]or[object Object]values.[object Object](int64_t, computation input): number of experts involved in the computation.[object Object](int64_t, computation input): number of tokens involved in the computation.[object Object](bool, computation input):[object Object]indicates that[object Object]is enabled, and[object Object]indicates that[object Object]is disabled.[object Object](aclTensor*, output): gradient of the input[object Object]. The value must be a 2D tensor with shape (tokens_num, hidden_size). The data type is the same as that of[object Object]. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The must be ND. are not supported.[object Object](aclTensor*, output): gradient of the input[object Object]. This is an optional output. The value must be a 2D tensor with shape (tokens_num, experts_num). The data type is the same as that of[object Object]. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The must be ND. are not supported.[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 the first-phase API[object Object].[object Object](aclOpExecutor*, input): operator executor, containing the operator computation process.[object Object](aclrtStream, input): stream for executing the task.
Returns:
- Deterministic computation:
[object Object]defaults to deterministic implementation.
- Non-dropPaddedMode scenario: The value of
[object Object]is less than or equal to[object Object]. - Mixed precision input is not supported. That is,
[object Object],[object Object],[object Object], and[object Object]must have the same data type.
The following example is for reference only. For details, see .
[object Object]