[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Implements the backward propagation of to complete the weighted summation of tokens.
  • Formula:gradXi=t=0topKgradExpandedX[expandedRowIdx[itopK+t]]gradX_i=\sum_{t=0}^{topK}gradExpandedX[expandedRowIdx[i * topK + t]]
[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]

    Shape symbol description:

    • B: batch size
    • S: number of tokens
    • H: hidden size, that is, the length of each token sequence
    • K: topK, that is, the number of experts that process tokens
    • A: value of activeNum
    • E: number of experts
    • C: expert capacity, that is, the threshold of the number of tokens that can be processed by an expert
  • Returns

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

    The first-phase API implements input parameter validation. The following error codes may be returned.

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

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

[object Object]