SetDequantType
Function Usage
If the input data type is int8 and the output data type is half, dequantization is required. There are two dequantization modes: single-element dequantization and vector dequantization.
- Single-element dequantization is a function of dequantizing all values of the output matrix by using the same dequantization coefficient. For details about the APIs that implement this function in the kernel, see SetQuantScalar.
- Vector dequantization is a function of dequantizing each row of the output matrix by using the dequantization coefficient in the corresponding row in the provided vector. For details about the APIs that implement this function in the kernel, see SetQuantVector.
This API is used to set the dequantization mode.
Prototype
1 | int32_t SetDequantType(DequantType deqType) |
Parameters
Parameter |
Input/Output |
Description |
||
|---|---|---|---|---|
deqType |
Input |
Sets the dequantization mode. Possible values:
|
Returns
-1: setting failed; 0: setting succeeded.
Precautions
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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_INT8); tiling.SetBType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_INT8); tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); tiling.SetBiasType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_INT32); tiling.SetShape(1024, 1024, 1024); tiling.SetOrgShape(1024, 1024, 1024); tiling.SetBias(true); tiling.SetDequantType(DequantType::TENSOR); //: Specify the dequantization mode. tiling.SetBufferSpace(-1, -1, -1); optiling::TCubeTiling tilingData; int ret = tiling.GetTiling(tilingData); |
Parent topic: Matmul Tiling Class