SetBias

Function Description

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

Table 1 Parameters

Parameter

Input/Output

Description

biasGlobal

Input

Initial address of the bias in the Global Memory, which is of the GlobalTensor type.

inputBias

Input

Initial address of the bias in the VECOUT/TSCM, which is of the LocalTensor type.

Returns

None

Availability

Precautions

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);