Help Center/ Atlas 300 Application (Model 3000)/ TE API Reference/ Convergence API/ bool BuildTeCustomOp(std::string ddkVer, std::string opName, std::string opPath, std::string opFuncName, const char *format, ...)
Updated on 2022-03-13 GMT+08:00

bool BuildTeCustomOp(std::string ddkVer, std::string opName, std::string opPath, std::string opFuncName, const char *format, ...)

Generates the *.o and *.json files of a single operator. You can view the API definitions in the ddk/include/inc/custom/custom_op.h file under the installation directory of the DDK package.

Parameter Description

  • ddkVer: product version number

    Version number rule: x.y.z.patch.B***

    x: corresponding to the VR version

    y: corresponding to the C version

    z: number of releases

    path: patch number (optional)

    B***: internal B version number

    For the specific version number, see the configuration in the ddk_info file under the installation directory of the DDK package.

  • opName: name of a single operator node on the network. The value cannot be empty and can contain only letters, digits, underscores (_), and hyphens (-).
  • opPath: path of the operator file. The directory contains slashes (/) and file names without filename extensions. The value cannot be empty. The file name can contain only letters, digits, underscores (_), and hyphens (-).
  • opFuncName: operator function name in the operator file. The function name can contain only letters, digits, underscores (_), and hyphens (-).
  • format: input parameter of an operator, which has a variable length and must be consistent with the parameter sequence of the operator

Return Value

  • true: A single operator is successfully generated.
  • false: A single operator fails to be generated.

Calling Example

std::string FilePath   = "topi/cce/caffe_reduction_layer";
std::string FuncName   = "caffe_reduction_layer_cce";
std::string KernelName = "cce_reductionLayer_5_10_5_5_float16__1_SUMSQ_1_0";

// i => int; s => string; f => dobule; O => bool, and bool value is Py_True or Py_False
te::BuildTeCustomOp(1.1.1.patch.B001, "reduction", FilePath, FuncName,"(i,i,i,i), s, i, s, f, s", 5, 5, 5, 5, "float16", 1, "SUM", 1.0,KernelName.c_str());