EnableFallBack
Function
This API is used to enable the fallback configuration. After the configuration is enabled, a fallback function is automatically generated and registered with GE. The core logic of the fallback function is to convert the input, output, and attributes of GE into the parameter format required by the aclnn single-operator API, and then call the aclnn API. In the dynamic graph scenario, GE can directly call the fallback function (the aclnn API is called in the function) to simplify the scheduling process. For details about the fallback operator, see in.
Prototype
1
|
OpDef &EnableFallBack(void) |
Parameters
None
Restrictions
- The operator needs to register and implement the InferShape function.
- The operator needs to register and implement the InferDataType function.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class AddCustom : public OpDef { public: AddCustom(const char* name) : OpDef(name) { this->Input("x").ParamType(REQUIRED).DataType({ge::DT_FLOAT}).Format({ge::FORMAT_ND}); this->Input("y").ParamType(REQUIRED).DataType({ge::DT_FLOAT}).Format({ge::FORMAT_ND}); this->Output("z").ParamType(REQUIRED).DataType({ge::DT_FLOAT}).Format({ge::FORMAT_ND}) this->AICore().AddConfig("ascendxxx"); this->SetInferShape(ge::InferShapeFunc); this->SetInferDataType(ge::InferDataTypeFunc); this->EnableFallBack(); } }; OP_ADD(AddCustom); |
Parent topic: OpDef