Description: Computes the sum of the product of α multiplied by mat1 and mat2 and the product of β multiplied by self. Compared with the original addmm API, the new API supports the NZ format for mat2.
Formula:
Example:
- For aclnnAddmmWeightNz, the shape of self is [n,], the shape of mat1 is [m, k], the shape of mat2 is [k, n], the shape of the matrix multiplication result of mat1 and mat2 is [m, n], and the shape of self can be broadcast to [m, n].
- For aclnnAddmmWeightNz, the shape of self is [1, n], the shape of mat1 is [m, k], the shape of mat2 is [k, n], the shape of the matrix multiplication result of mat1 and mat2 is [m, n], and the shape of self can be broadcast to [m, n].
- For aclnnAddmmWeightNz, the shape of self is [m, n], the shape of mat1 is [m, k], the shape of mat2 is [k, n], and the shape of the matrix multiplication result of mat1 and mat2 is [m, n].
Each operator has calls. First, aclnnAddmmWeightNzGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnAddmmWeightNz is called to perform computation.
Parameters
[object Object]- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], and Ascend 950PR/Ascend 950DT:
- cubeMathType=1: If the input data type is FLOAT32, it is converted to HFLOAT32 for computation. If the input data type is not FLOAT32, no processing is performed.
- cubeMathType=2: If the input data type is BFLOAT16, this option is not supported.
- cubeMathType=3: If the input data type is FLOAT32, it is converted to HFLOAT32 for computation. If the input data type is not FLOAT32, this option is not supported.
- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]:
- The data type BFLOAT16 is not supported.
- cubeMathType=0 is not supported when the input data type is FLOAT32.
- cubeMathType=1: If the input data type is FLOAT32, it is converted to FLOAT16 for computation. If the input data type is not FLOAT32, no processing is performed.
- cubeMathType=3 is not supported.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], and Ascend 950PR/Ascend 950DT:
Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Determinism description: The aclnnAddmmWeightNz is implemented in deterministic mode by default.
Computational consistency description
- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]:
- If strong consistency compute is enabled, the compute result is deterministic, meaning that multiple executions will generate the same result. In addition, the compute result is irrelevant to the data location.
- aclnnAddmmWeightNz defaults to a non-consistent implementation. You can call aclrtCtxSetSysParamOpt to enable consistency compute.
- For example, when performing matrix multiplication, the order of accumulation across different basic blocks may vary, which may lead to slight differences in results for the same data in different rows. However, when strong consistency compute is enabled, the results will remain consistent across rows as long as the inputs are the same.
- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]:
If one of the inputs of mat1 and mat2 is BFLOAT16 and the other is FLOAT or FLOAT16, the data type cannot be deduced.
The last axis of mat2 cannot be 1, that is, k=1 or n=1.
The following example is for reference only. For details, see .