Description: Computes the sum of the product of α multiplied by mat1 and mat2 and the product of β multiplied by self.
Formula:
Example:
- For aclnnAddmm, 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 aclnnAddmm, the shape of self is [m, 1], 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 aclnnAddmm, 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].
- For aclnnInplaceAddmm, the computation result is directly stored in the memory of the input tensor selfRef. The shape of self is [m, n], the shape of mat1 is [m, k], and the shape of mat2 is [k, n].
- aclnnAddmm and aclnnInplaceAddmm implement the same function in different ways. Select a proper operator based on your requirements.
- aclnnAddmm: An output tensor object needs to be created to store the computation result.
- aclnnInplaceAddmm: No output tensor object needs to be created, and the computation result is stored in the memory of the input tensor.
- Each operator has calls. First, aclnnAddmmGetWorkspaceSize or aclnnInplaceAddmmGetWorkspaceSize is called to obtain input parameters and calculate the required workspace size based on the computation process. Then, aclnnAddmm or aclnnInplaceAddmm is called to perform computation.
[object Object]
[object Object]
[object Object]
[object Object]
Parameters:
[object Object]- [object Object]Atlas training series products[object Object] and [object Object]Atlas inference series 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] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]:
- 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 series products[object Object] and [object Object]Atlas inference series products[object Object]:
Returns:
aclnnStatus: status code. For details, see .
The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Parameters:
[object Object]- [object Object]Atlas training series products[object Object] and [object Object]Atlas inference series 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] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]:
- 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 series products[object Object] and [object Object]Atlas inference series products[object Object]:
Returns:
aclnnStatus: status code. For details, see .
The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
- Determinism:
- [object Object]Atlas training series products[object Object] and [object Object]Atlas inference series products[object Object]: aclnnAddmm&aclnnInplaceAddmm defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
- Compute consistency:
- [object Object]Atlas training series products[object Object] and [object Object]Atlas inference series 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.
- aclnnAddmm&aclnnInplaceAddmm 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 series products[object Object] and [object Object]Atlas inference series products[object Object]:
The following example is for reference only. For details, see .
[object Object]