[object Object][object Object][object Object]undefined
[object Object]
  • Description: Performs sigmoid calculation on input x during MoE calculation, sorts the calculation results by group, and selects the top k experts based on the group sorting result.

  • Formula:

    Computes sigmoid of the input element-wise.

    sigmoidRes=sigmoid(x)sigmoidRes=sigmoid(x)

    Add addNum:

    normOut=sigmoidRes+addNumnormOut = sigmoidRes + addNum

    Group the computation results based on [object Object], sort each group based on the sum value of top N, and select the first [object Object] groups.

    groupOut,groupId=TopK(ReduceSum(TopK(Split(normOut,groupCount),k=2,dim=1),dim=1),k=kGroup)groupOut, groupId = TopK(ReduceSum(TopK(Split(normOut, groupCount), k=2, dim=-1), dim=-1),k=kGroup)

    Obtain the corresponding element in [object Object] based on the [object Object] obtained in the previous step, and perform topK on the data to obtain the indices result.

    normY,indices=TopK(normOut[groupId,:],k=k)normY,indices=TopK(normOut[groupId, :],k=k)

    Select [object Object] from [object Object] based on indices.

    y=gather(sigmoidRes,indices)y = gather(sigmoidRes, indices)

    If [object Object] is [object Object], [object Object] is computed based on the input scale parameter to obtain the result of [object Object].

    y=y/(ReduceSum(y,dim=1))scaley = y / (ReduceSum(y, dim=-1))*scale

    If [object Object] is [object Object], the physical experts in indices are mapped to logical experts based on the input [object Object] and [object Object] to obtain the output indices.

[object Object]

Each operator consists of . You must first call the [object Object] API to obtain the required workspace size and the executor that contains the operator computation flow, and then call the [object Object] API to execute the 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 a deterministic implementation.
  • [object Object] must be an integer multiple of [object Object].

  • [object Object] must be less than or equal to [object Object].

  • [object Object] must be less than or equal to 128.

  • [object Object] must be less than or equal to [object Object].

  • [object Object] must be less than or equal to [object Object]/[object Object].

  • [object Object] must be less than or equal to 1024.

  • [object Object] must be less than or equal to 256.

[object Object]

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

[object Object]