OpAICoreConfig Constructor

Function

OpAICoreConfig constructor.

Prototype

1
2
OpAICoreConfig()
OpAICoreConfig(const char *soc)

Parameters

Parameter

Input/Output

Description

soc

Input

AI Processor model.

Returns

None

Restrictions

The constructor that takes the SoC input parameter initializes some parameters in the OpAICoreConfig structure. The following table lists the parameters and their initial values.

Configuration parameters

Description

Initial value

DynamicCompileStaticFlag

Indicates whether the operator implementation supports static shape build during graph input.

true

DynamicFormatFlag

Determines whether to automatically infer the dtype and format supported by the operator inputs and outputs based on the function configured in SetOpSelectFormat.

true

DynamicRankSupportFlag

Indicates whether the operator supports dynamicRank.

true

DynamicShapeSupportFlag

Indicates whether the operator supports dynamic shape scenarios during graph input.

true

NeedCheckSupportFlag

Determines whether to call the operator parameter verification function to verify the data type and shape during operator fusion.

false

PrecisionReduceFlag

Controls the operator precision mode during ATC-based model conversion or network commissioning.

true

The default constructor without input parameters does not initialize the preceding parameters.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class AddCustom : public OpDef {
public:
    AddCustom(const char* name) : OpDef(name)
    {
        this->Input("x").DataType({ ge::DT_FLOAT16 }).ParamType(OPTIONAL);
        this->Output("y").DataType({ ge::DT_FLOAT16 });
        // Use the constructor with the SoC input parameter.
        OpAICoreConfig aicConfig1("ascendxxx1");
        OpAICoreConfig aicConfig2("ascendxxx2");
        aicConfig1.Input("x")
            .ParamType(OPTIONAL)
            .DataType({ ge::DT_FLOAT })
            .Format({ ge::FORMAT_ND });
        aicConfig2.Input("x")
            .ParamType(REQUIRED)
            .DataType({ ge::DT_INT32 })
            .Format({ ge::FORMAT_ND });
        this->AICore().AddConfig("ascendxxx1", aicConfig1);
        this->AICore().AddConfig("ascendxxx2", aicConfig2);
    }
};