SetBiasType
Function Usage
Sets the position, data format, data type, and transpose status of the bias matrix. These settings must be consistent with those in the kernel.
Prototype
1 | int32_t SetBiasType(TPosition pos, CubeFormat type, DataType dataType) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
pos |
Input |
Position in the buffer where the bias matrix is located, which can be TPosition::GM or TPosition::VECOUT. |
type |
Input |
Data format of the bias matrix, which can be CubeFormat::ND. |
dataType |
Input |
Data type of the bias matrix, which can be DataType::DT_FLOAT, DataType::DT_FLOAT16, or DataType::DT_INT32. The data type of Bias can be set to INT32 only when the data type of matrices A and B is INT8. |
Returns
The value -1 indicates that the setting fails, and the value 0 indicates that the setting is successful.
Precautions
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); tiling.SetAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); tiling.SetBType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT); tiling.SetBiasType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT); // Set the bias matrix. tiling.SetShape(1024, 1024, 1024); tiling.SetOrgShape(1024, 1024, 1024); tiling.SetBias(true); tiling.SetBufferSpace(-1, -1, -1); optiling::TCubeTiling tilingData; int ret = tiling.GetTiling(tilingData); |
Parent topic: Matmul Tiling Class