aclopCompile

Description

Compiles an operator. Before compiling an operator, call aclSetCompileopt to set the compilation option and call aclopSetCompileFlag to set the operator compilation mode (fuzzy compilation or non-fuzzy compilation).

Restrictions

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 compiled flag.

typedef enum aclCompileType {
    ACL_COMPILE_SYS, //The operator has been registered with GE and FE.
    ACL_COMPILE_UNREGISTERED  //The operator has not been registered with GE or FE. (The .py source file will be used to compile the operator.)

} aclopCompileType;

opPath

Input

Pointer to the path of the operator implementation file (.py), excluding the file name.

Required if compileFlag = ACL_COMPILE_UNREGISTERED.

opPath does not include the .py file name. The path can be absolute or relative. When using a relative path, the parent directory of the relative path must be configured in the environment variable PYTHONPATH. Assume that the operator .py file is stored in the absolute path /A/B/C/ and opPath is set to the relative path ./C. Then, /A/B must be added to the environment variable PYTHONPATH.

Returns

0 on success; else, failure.