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

Table 1 Parameters

Parameter

Input/Output

Description

pos

Input

Position in the buffer where the bias matrix is located, which can be TPosition::GM, TPosition::TSCM, or TPosition::VECOUT.

type

Input

Data format of the bias matrix, which can be CubeFormat::ND.

dataType

Input

Data type of the bias, which can be DataType::DT_FLOAT, DataType::DT_FLOAT16, DataType::DT_BFLOAT16, or DataType::DT_INT32.

The data type of the bias can be set to int32_t only when the data types of matrices A and B are both int8_t.

Returns

-1: setting failed; 0: setting succeeded.

Restrictions

None

Example

1
2
3
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); 
tiling.SetBiasType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT);  // Set the bias matrix.