Input
Function
In some scenarios, an operator supports different prototype inputs on different AI Processor models.
This API can register differentiated operator inputs for different AI Processor models. After this API is called, an OpParamDef structure is returned. You can use this structure to configure operator inputs.
Prototype
1
|
OpParamDef &Input(const char *name) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
name |
Input |
Operator input name. |
Returns
Operator parameter definition. For details about OpParamDef, see OpParamDef.
Constraints
None
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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 }); OpAICoreConfig aicConfig1; OpAICoreConfig aicConfig2; 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); } }; |
Parent topic: OpAICoreConfig