SetBias
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
x |
|
x |
Function
Sets the bias for matrix multiplication.
Prototype
1 | __aicore__ inline void SetBias(const GlobalTensor<BiasT>& biasGlobal) |
1 | __aicore__ inline void SetBias(const LocalTensor<BiasT>& inputBias) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
biasGlobal |
Input |
Bias. The type is GlobalTensor. For the For the For the For the For details about the data type combinations supported by matrices A and B and the bias, see Table 2. |
inputBias |
Input |
Bias. The type is LocalTensor, and TPosition can be VECOUT. For the For the For the For the For details about the data type combinations supported by matrices A and B and the bias, see Table 2. |
Returns
None
Restrictions
- In Matmul tiling computation, the isBias parameter in the TCubeTiling structure must be set to 1 (that is, the bias is enabled) before this API is called to set the bias.
- Ensure that the size of the input bias address space is greater than or equal to singleN.
Example
1 2 3 4 5 | REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetBias(gm_bias); // Set the bias. mm.IterateAll(gm_c); |