更新时间:2021-10-26 GMT+08:00
分享

custom_op_run函数

函数功能

自定义算子的单算子调测入口函数。该函数在“custom\custom_op.h”中定义。

custom_op_run接口的返回值是ErrorInfo类型,包含错误码、错误描述。当错误码为0时,表示成功;当错误码为其它值时,表示失败。ErrorInfo类型的定义如下:

struct ErrorInfo
    {
        uint32_t    error_code;
        std::string error_msg;
    };

函数原型

ErrorInfo custom_op_run(const std::string& name, int32_t type, const std::string& bin_file,

const std::vector< std::string >& in_files,

const std::vector< std::string >& out_files,

const std::vector< uint32_t >& out_buf_sizes,

const std::vector< uint32_t >& workspace_sizes = std::vector<uint32_t>(),

const std::string& op_cfg_file = "", void *param = nullptr, int param_len = 0);

参数说明

参数

输入/输出

说明

name

输入

算子kernel名称。

type

输入

算子类型:

  • 0 - TE_AICORE
  • 1 -TE_AICPU
  • 2 - AI CPU

bin_file

输入

算子二进制文件路径,包含文件名。

路径支持配置相对路径,此时二进制文件需存放在程序所在的目录下,如:./*.bin

in_files

输入

输入数据文件路径,包含文件名。

路径支持配置相对路径,此时数据文件需存放在程序所在的目录下。

out_files

输入

输出数据文件路径,包含文件名。

路径支持配置相对路径,此时数据文件需存放在程序所在的目录下。

out_buf_sizes

输入

输出数据大小,单位是字节。

workspace_sizes

输入

workspace大小,单位是字节。

op_cfg_file

输入

用户指定的算子的输入输出描述信息。

param

输入

用户指定的算子参数结构体地址信息。

param_len

输入

用户指定的算子参数结构体的长度,使用sizeof(param)取结构体长度,单位是字节。

分享:

    相关文档

    相关产品