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

custom_op_compare函数

函数功能

自定义算子的单算子校验接口,用于校验数据精度。该函数在“custom\custom_op.h”中定义。

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

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

函数原型

ErrorInfo custom_op_compare(const std::string& expect_file, const std::string& actual_file,

int32_t data_type, float precision_deviation,

float statistical_discrepancy, bool& compare_result);

参数说明

参数

输入/输出

说明

expect_file

输入

期望数据文件,包含文件名

actual_file

输入

实际数据文件,包含文件名

data_type

输入

算子类型,目前支持FP32(0)、FP16(1)

precision_deviation

输入

单数据精度偏差,数值范围(0,1),偏差越小,精度越高。

statistical_discrepancy

输入

整个数据集的统计偏差,数值范围(0,1),偏差越小,精度越高。

compare_result

输出

比较结果, true:对比成功;false:对比失败

分享:

    相关文档

    相关产品