OpAICoreConfig Constructor

Function

Constructs an object of class OpAICoreConfig.

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 parameters initializes some parameters in the OpAICoreConfig structure. The following table lists the parameters and their initial values.

Parameter

Description

Initial Value

DynamicCompileStaticFlag

Indicates whether the operator implementation supports static shape compilation during graph building.

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 (dynamic dimension).

true

DynamicShapeSupportFlag

Indicates whether the operator supports the dynamic shape scenario during graph building.

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 debugging.

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 SoC input parameters.
        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);
    }
};