SetWeightType

Function

Sets the position, data format, and data type of Weight in the memory.

Prototype

1
void SetWeightType(const ConvCommonApi::TPosition pos, const ConvCommonApi::ConvFormat format, const ConvCommonApi::ConvDtype dtype)

Parameters

Parameter

Input/Output

Description

pos

Input

Position of the weight in the memory. For details, see Position. Currently, only TPosition::GM is supported.

format

Input

Weight data format. Currently, only ConvFormat::FRACTAL_Z_3D is supported.

dtype

Input

Weight data type. Currently, only ConvDtype::FLOAT16 and ConvDtype::BF16 are supported.

Returns

None

Restrictions

This API is optional before calling the GetTiling API. If this API is not called, the default Weight is pos=TPosition::GM, format=ConvFormat::FRACTAL_Z_3D and dtype=ConvDtype::FLOAT16.

Example

1
2
3
4
// Instantiate the Conv3D API.
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
Conv3dTilingApi::Conv3dTiling conv3dApiTiling(ascendcPlatform);
conv3dApiTiling.SetWeightType(ConvCommonApi::TPosition::GM, ConvCommonApi::ConvFormat::FRACTAL_Z_3D, ConvCommonApi::ConvDtype::BF16);