[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Computes the backpropagation of [object Object].
  • Formula:permuteTokenId,outIndex=sortedIndices.sort(dim=1)permuteTokenId, outIndex= sortedIndices.sort(dim=-1) capacity=permutedTokensOutputGrad.size(0)/numExpertscapacity = permutedTokensOutputGrad.size(0) / numExperts
    • When [object Object] is not set to [object Object]:

      probsGradOutOptional=zeros(tokensnum,numExperts)probsGradOutOptional = zeros(tokens_num, numExperts)
    • When dropPaddedMode is true:

      probsGradOutOptional[sortedIndices[i],i/capacity]=permutedProbsOutputGradOptional[i]probsGradOutOptional [sortedIndices[i], i/capacity] = permutedProbsOutputGradOptional[i]
    • When dropPaddedMode is false:

      probsGradOutOptional=maskedscatter(probsGradOutOptional,routingMapOptional,permutedProbsOutputGradOptional)probsGradOutOptional = maskedscatter(probsGradOutOptional,routingMapOptional, permutedProbsOutputGradOptional)
    • If [object Object] is set to [object Object]:

      tokensGradOut=zeros(restoreShapeOptional,dtype=permutedTokens.dtype,device=permutedTokens.device)tokensGradOut= zeros(restoreShapeOptional, dtype=permutedTokens.dtype, device=permutedTokens.device) tokensGradOut[permuteTokenId[i]]+=permutedTokens[outIndex[i]]tokensGradOut[permuteTokenId[i]] += permutedTokens[outIndex[i]]
[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]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

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

    The first-phase API implements input parameter verification. The following errors may be thrown:

    [object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

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

[object Object]
  • Deterministic computation:

    • [object Object] defaults to deterministic implementation.
  • Non-dropPaddedMode scenario: 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]