[object Object][object Object][object Object]undefined
[object Object]
  • Description: Performs the backpropagation of .
  • Formula:inputGrad=permutedOutputGrad.indexSelect(0,sortedIndices)inputGrad = permutedOutputGrad.indexSelect(0, sortedIndices) inputGrad=inputGrad.reshape(1,topK,hiddenSize)inputGrad = inputGrad.reshape(-1, topK, hiddenSize) inputGrad=inputGrad.sum(dim=1)inputGrad = inputGrad.sum(dim = 1)
[object Object]

Each operator has calls. First, [object Object] is called to obtain the input parameters, 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]
[object Object]
  • Parameters:

    • [object Object] (aclTensor*, computation input): aclTensor on the device, which is the gradient of the forward output [object Object]. It must be a 2D tensor with shape (tokens_num * topK_num, hidden_size). [object Object] indicates the number of tokens, and [object Object] indicates the value of [object Object]. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The must be ND.
    • [object Object] (aclTensor*, computation input): aclTensor on the device, whose shape is (tokens_num topK_num). The data type can be INT32. The value range is [0, tokens_num topK_num – 1], and there is no duplicate index. The must be ND.
    • [object Object] (int64_t, computation input): number of selected experts.
      • [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 value of [object Object] is less than or equal to [object Object].
    • [object Object] (bool, computation input): [object Object] indicates that [object Object] is enabled, and [object Object] indicates that [object Object] is disabled. Currently, only [object Object] is supported.
    • [object Object] (aclTensor*, computation output): gradient of the input token. The value must be a 2D tensor with shape (tokens_num, hidden_size). The data type is the same as that of [object Object], supporting BFLOAT16, FLOAT16, and FLOAT32. The must be ND.
    • [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] status code. For details, see .

[object Object]
[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:

    [object Object] status code. For details, see .

[object Object]
  • Deterministic computation:

    • [object Object] defaults to deterministic implementation.
  • [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 value of [object Object] is less than or equal to [object Object].

[object Object]

The following example is for reference only. For details, see .

[object Object]