Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
// TODO(): move compare_mlvalue.{h,cc} to test dir
 
#include <core/framework/ort_value.h>
#include <string>
 
namespace ONNX_NAMESPACE {
class ValueInfoProto;
}
 
namespace Ort {
struct Value;
}
 
namespace onnxruntime {
 
enum class COMPARE_RESULT {
  SUCCESS,
  RESULT_DIFFERS,
  TYPE_MISMATCH,
  SHAPE_MISMATCH,
  NOT_SUPPORT,
};
 
std::pair<COMPARE_RESULT, std::string> CompareOrtValue(const OrtValue& real, const OrtValue& expected,
                                                       double per_sample_tolerance,
                                                       double relative_per_sample_tolerance, bool post_processing);
 
// Compare two OrtValue numerically equal or not. The difference with CompareOrtValue is that this function
// will only check the numerical values of the OrtValue, and ignore the type, shape, etc.
//
// For example, if some tests run CPU EP baseline with float, and run CUDA test with float16, we could check
// them without converting the float16 to float. Be noted: we will try convert the float value to float16
// then back to float, to simulate rounding to half.
//
// If not equal, only return one single the differed value pair (to avoid multiple thread
// append into the same error_message string stream).
std::pair<COMPARE_RESULT, std::string> CompareOrtValueNumerals(const OrtValue& real,
                                                               const OrtValue& expected,
                                                               double per_sample_tolerance,
                                                               double relative_per_sample_tolerance);
 
// verify if the 'value' matches the 'expected' ValueInfoProto. 'value' is a model output
std::pair<COMPARE_RESULT, std::string> VerifyValueInfo(const ONNX_NAMESPACE::ValueInfoProto& expected,
                                                       const OrtValue* value);
}  // namespace onnxruntime