文档首页> Atlas 500应用> TE API参考> 融合接口> bool BuildTeCustomOp(std::string ddkVer, std::string opName, std::string opPath, std::string opFuncName, const char *format, ...)
更新时间:2021-03-18 GMT+08:00
分享

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

调用该接口用于生成单算子的*.o文件和*.json文件。您可以在DDK包的安装目录下的“ddk/include/inc/custom/custom_op.h”文件中查看接口的定义。

参数说明

  • ddkVer:指产品的版本号。

    版本号统一规则:x.y.z.patch.B***。

    x:对应VR版本;

    y:对应C版本;

    z:对应发布计数;

    path:补丁号,可选参数;

    B***:内部B版本号;

    具体版本号参考DDK包的安装目录下ddk_info文件中的配置。

  • opName:指网络中单个算子节点名称,其值不能为空,且名称中只能包含字母、数字、下划线或中划线。
  • opPath:指算子文件的路径,以“/”区分目录且文件名称不带扩展名,其值不能为空。文件名称中只能包含字母、数字、下划线或中划线。
  • opFuncName:指算子文件中算子函数名称。函数名称中只能包含字母、数字、下划线或中划线。
  • format:算子的入参,属于变长变量,需要与算子的参数顺序保持一致。

返回值:

  • true:表示生成单算子成功
  • false:表示生成单算子失败。

调用示例

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());
分享:

    相关文档

    相关产品