SetTensorA
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
x |
|
x |
Function
Sets the left matrix A for matrix multiplication.
Prototype
1 | __aicore__ inline void SetTensorA(const GlobalTensor<SrcAT>& gm, bool isTransposeA = false) |
1 | __aicore__ inline void SetTensorA(const LocalTensor<SrcAT>& leftMatrix, bool isTransposeA = false) |
1 | __aicore__ inline void SetTensorA(SrcAT aScalar) |
The SetTensorA(SrcAT aScalar) API prototype is not supported by the
The SetTensorA(SrcAT aScalar) API prototype is not supported by the
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
gm |
Input |
Matrix A. The type is GlobalTensor. SrcAT indicates the data type of matrix A. For the For the For the For the |
leftMatrix |
Input |
Matrix A. The type is LocalTensor, and TPosition can be TSCM or VECOUT. SrcAT indicates the data type of matrix A. For the For the For the For the If the initial address in the TSCM is set, the matrix can be fully loaded by default. In this case, the Iterate API does not need to transfer data from GM to A1/B1. |
aScalar |
Input |
Value set in matrix A. Scalar data can be passed. The passed scalar data is expanded into a tensor with the shape of [1, K] to participate in matrix multiplication. The tensor values are all scalar values. For example, a developer can implement a reduce sum operation on matrix B in the K direction by setting aScalar to 1. SrcAT indicates the data type of matrix A. For the For the This parameter is not supported by the This parameter is not supported by the |
isTransposeA |
Input |
Whether matrix A should be transposed. Notes:
For the For the For the |
Returns
None
Restrictions
Ensure that the size of the input TensorA address space is greater than or equal to singleM x singleK.
Example
1 2 3 4 5 6 7 8 9 10 | REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); // Example 1: The left matrix is in the global memory. mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetBias(gm_bias); mm.IterateAll(gm_c); // Example 2: The left matrix is in the local memory. mm.SetTensorA(local_a); // Example 3: Set scalar data. mm.SetTensorA(scalar_a); |