Function: register_cpu_func

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Supported
  • Atlas inference products: Supported
  • Atlas training products: Supported

Function

If the acl.rt.binary_load_from_data API is used to load the binary data of an AI CPU operator, this API must be used to register the AI CPU operator information to obtain the corresponding func_handle. This API applies only to AI CPU operators. For other operators, the error code ACL_ERROR_RT_PARAM_INVALID is returned.

Prototype

  • C Prototype

    aclError aclrtRegisterCpuFunc(const aclrtBinHandle handle, const char *funcName, const char *kernelName, aclrtFuncHandle *funcHandle)
    
  • Python Function

    func_handle, ret = acl.rt.register_cpu_func(bin_handle, func_name, kernel_name)
    

Parameters

Parameter Description
bin_handle Int, handle of the operator binary. Call acl.rt.binary_load_from_data to obtain the binary handle of the operator, and then pass the handle to this API as an input parameter.
func_name Str, entry point function for executing the AI CPU operator. It cannot be left blank.
kernel_name Str, opType of the AI CPU operator. It cannot be left blank.

Return Values

Return Value Description
func_handle Int, kernel function handle.
ret Int. If 0 is returned, the operation is successful. If other values are returned, the operation fails.