aclopCompile
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Builds an operator. The build options are set by using the aclSetCompileopt call.
As the inputs and outputs of operators are organized differently from each other, the API organizes operators in strict accordance with their input and output parameters. When aclopCompile is called, the API searches for the corresponding task based on the optype, input tensor description, output tensor description, and attributes before building the operator.
Prototype
aclError aclopCompile(const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], int numOutputs, const aclTensorDesc *const outputDesc[], const aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, const char *opPath)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
opType |
Input |
Pointer to the operator type name. |
numInputs |
Input |
Number of input tensors. |
inputDesc |
Input |
Pointer array of the input tensor description. Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. The array length is consistent with numInputs. |
numOutputs |
Input |
Number of output tensors. |
outputDesc |
Input |
Pointer array of the output tensor description. Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. The array length is consistent with numOutputs. |
attr |
Input |
Pointer to the operator attributes. Call aclopCreateAttr to create data of the aclopAttr type in advance. |
engineType |
Input |
Operator execution engine. |
compileFlag |
Input |
Operator built flag. |
opPath |
Input |
Pointer to the path of the operator implementation file (.py), excluding the file name. This parameter is reserved. Currently, this parameter can only be set to nullptr. |
Returns
0 on success; else, failure. For details, see aclError.
Restrictions
- To build a dynamic-shape operator with known shape range, set the element value in the dims array that indicates a dynamic dimension to –1 when creating data of the aclTensorDesc type by using the aclCreateTensorDesc call, and then call aclSetTensorShapeRange to set the size range of each dimension for a tensor. To build a dynamic-shape operator with an unknown shape range (which is reserved in the current version), set the dims array to –2 when creating data of the aclTensorDesc type by using the aclCreateTensorDesc call, for example, int64_t dims[] = {-2}.
- To build an operator with an unused optional input, create data of the aclTensorDesc type by using the aclCreateTensorDesc(ACL_DT_UNDEFINED, 0, nullptr, ACL_FORMAT_UNDEFINED) call, indicating that the data type is ACL_DT_UNDEFINED, the format is ACL_FORMAT_UNDEFINED, and the shape is nullptr.
- Before building an operator with constant input, call aclSetTensorConst to set the constant input. The constant input passed to the aclopCompile and aclopExecuteV2 calls must be consistent.