Description:
The function is equivalent to the implementation of Megatron's matmul and fused_vocab_parallel_cross_entropy. It supports splitting and fusion of matmul and celoss in the vocabulary_size dimension. Based on the communication, the intermediate operations require and , which need to be called in sequence for complete function implementation.
Formula:
- The matrix multiplication of and is as follows:
- Calculate the maximum value of each row in .
- Calculate the difference between and .
- Calculate the sum of each row after the exponential operation on .
- Calculate the mask where is less than or is greater than .
- Calculate .
- Calculate .
- Calculate .
In the preceding information, .
Each operator has calls. First, aclnnFusedLinearOnlineMaxSumGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnFusedLinearOnlineMaxSum is called to perform computation.
Parameters
[object Object]Returns
[object Object][object Object]: status code. For details, see . The first-phase API implements input parameter verification. The following errors may be thrown.
- Deterministic description:
- [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 aclnnFusedLinearOnlineMaxSum is implemented in a deterministic manner by default.
The following example is for reference only. For details, see .