1
1
diff --git a/CMakeLists.txt b/CMakeLists.txt
2
- index d15d97ed..bdacac99 100644
2
+ index 6fe5c96e..087a7780 100644
3
3
--- a/CMakeLists.txt
4
4
+++ b/CMakeLists.txt
5
- @@ -27 ,6 +27 ,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
5
+ @@ -40 ,6 +40 ,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
6
6
option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
7
- option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for onnx operator schemas." OFF)
7
+ option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for ONNX operator schemas." OFF)
8
8
option(ONNX_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF)
9
9
+ option(ONNX_MINIMAL_BUILD "Build only essential ONNX components" OFF)
10
-
11
- if(NOT DEFINED ONNX_ML )
12
- if(DEFINED ENV{ONNX_ML} )
13
- @@ -457 ,14 +458 ,28 @@ relative_protobuf_generate_cpp(gen_onnx_data_proto
10
+ if(WIN32)
11
+ option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime" OFF )
12
+ endif( )
13
+ @@ -461 ,14 +462 ,28 @@ relative_protobuf_generate_cpp(gen_onnx_data_proto
14
14
list(APPEND ONNX_PROTO_SRCS ${__tmp_srcs})
15
15
list(APPEND ONNX_PROTO_HDRS ${__tmp_hdrs})
16
16
@@ -47,18 +47,18 @@ index d15d97ed..bdacac99 100644
47
47
48
48
add_library(onnx_proto ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS})
49
49
add_dependencies(onnx_proto gen_onnx_operators_proto gen_onnx_data_proto)
50
- @@ -496 ,6 +511 ,7 @@ if (MSVC)
50
+ @@ -492 ,6 +507 ,7 @@ if(MSVC)
51
51
endif()
52
52
else()
53
53
# On non-Windows, hide all symbols we don't need
54
54
+ set(EXTRA_FLAGS "-Wno-unused-parameter")
55
55
set(ONNX_API_DEFINE "-DONNX_API=__attribute__\(\(__visibility__\(\"default\"\)\)\)")
56
56
set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
57
57
set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
58
- @@ -631,20 +647,9 @@ endif()
59
- if(MSVC)
60
- target_compile_options(onnx_proto
58
+ @@ -620,21 +636,11 @@ if(MSVC)
61
59
PRIVATE /MP
60
+ /wd4146 # unary minus operator applied to unsigned type,
61
+ # result still unsigned
62
62
- /wd4244 #'argument': conversion from 'google::
63
63
- #protobuf::uint64' to 'int', possible
64
64
- # loss of data
@@ -67,42 +67,93 @@ index d15d97ed..bdacac99 100644
67
67
${EXTRA_FLAGS})
68
68
target_compile_options(onnx
69
69
PRIVATE /MP
70
+ /wd4146 # unary minus operator applied to unsigned type,
71
+ # result still unsigned
70
72
- /wd4244 # 'argument': conversion from 'google::
71
73
- # protobuf::uint64' to 'int', possible
72
74
- # loss of data
73
75
- /wd4267 # Conversion from 'size_t' to 'int',
74
76
- # possible loss of data
75
- - /wd4996 # The second parameter is ignored.
76
77
${EXTRA_FLAGS})
77
- if(ONNX_USE_PROTOBUF_SHARED_LIBS)
78
- target_compile_options(onnx_proto
79
- diff --git a/onnx/common/file_utils.h b/onnx/common/file_utils.h
80
- index b847798e..a6c31904 100644
81
- --- a/onnx/common/file_utils.h
82
- +++ b/onnx/common/file_utils.h
83
- @@ -6,7 +6,6 @@
78
+ add_msvc_runtime_flag(onnx_proto)
79
+ add_msvc_runtime_flag(onnx)
80
+ diff --git a/onnx/defs/nn/defs.cc b/onnx/defs/nn/defs.cc
81
+ index 64366270..4aed9027 100644
82
+ --- a/onnx/defs/nn/defs.cc
83
+ +++ b/onnx/defs/nn/defs.cc
84
+ @@ -36,7 +36,7 @@ static const char* conv_transpose_auto_pad_doc =
85
+ "on whether it is even or odd). In case the padding is an odd number, the extra "
86
+ "padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.";
87
+
88
+ - static void convPoolShapeInference(
89
+ + void convPoolShapeInference(
90
+ InferenceContext& ctx,
91
+ bool use_dilation,
92
+ bool require_kernel_shape,
93
+ @@ -1102,7 +1102,7 @@ ONNX_OPERATOR_SET_SCHEMA(
94
+ convPoolShapeInference(ctx, true, false, 0, 1);
95
+ }));
96
+
97
+ - static void convTransposeShapeInference(InferenceContext& ctx) {
98
+ + void convTransposeShapeInference(InferenceContext& ctx) {
99
+ propagateElemTypeFromInputToOutput(ctx, 0, 0);
84
100
85
- #pragma once
101
+ // we need at least two inputs to have a shape for this inference.
102
+ @@ -1462,7 +1462,7 @@ ONNX_OPERATOR_SET_SCHEMA(
103
+ }));
86
104
87
- - #include <filesystem>
88
- #include <fstream>
89
- #include <string>
105
+ // For GlobalPool operations.
106
+ - static void globalPoolTypeShapeInference(InferenceContext& ctx) {
107
+ + void globalPoolTypeShapeInference(InferenceContext& ctx) {
108
+ propagateElemTypeFromInputToOutput(ctx, 0, 0);
90
109
91
- @@ -17,8 +16,7 @@ namespace ONNX_NAMESPACE {
110
+ // needs at least one input with shape.
111
+ diff --git a/onnx/defs/nn/old.cc b/onnx/defs/nn/old.cc
112
+ index d8ca9a46..1eda4c70 100644
113
+ --- a/onnx/defs/nn/old.cc
114
+ +++ b/onnx/defs/nn/old.cc
115
+ @@ -4023,7 +4023,6 @@ ONNX_OPERATOR_SET_SCHEMA(
116
+ GroupNormalization,
117
+ 18,
118
+ OpSchema()
119
+ - .Deprecate()
120
+ .SetDoc(GroupNormalization_ver18_doc)
121
+ .Attr("epsilon", "The epsilon value to use to avoid division by zero.", AttributeProto::FLOAT, 1e-5f)
122
+ .Attr(
123
+ diff --git a/onnx/defs/rnn/defs.cc b/onnx/defs/rnn/defs.cc
124
+ index c0ed3a39..6c8e2909 100644
125
+ --- a/onnx/defs/rnn/defs.cc
126
+ +++ b/onnx/defs/rnn/defs.cc
127
+ @@ -5,7 +5,7 @@
128
+ #include "onnx/defs/schema.h"
92
129
93
- template <typename T>
94
- void LoadProtoFromPath(const std::string proto_path, T& proto) {
95
- - std::filesystem::path proto_u8_path = std::filesystem::u8path(proto_path);
96
- - std::fstream proto_stream(proto_u8_path, std::ios::in | std::ios::binary);
97
- + std::fstream proto_stream(proto_path, std::ios::in | std::ios::binary);
98
- if (!proto_stream.good()) {
99
- fail_check("Unable to open proto file: ", proto_path, ". Please check if it is a valid proto. ");
100
- }
130
+ namespace ONNX_NAMESPACE {
131
+ - static void RNNShapeInference(InferenceContext& ctx) {
132
+ + void RNNShapeInference(InferenceContext& ctx) {
133
+ TensorShapeProto::Dimension num_directions, seq_length, batch_size, hidden_size;
134
+
135
+ auto direction = getAttribute(ctx, "direction", "forward");
136
+ diff --git a/onnx/defs/schema.h b/onnx/defs/schema.h
137
+ index 42318d82..a33cf342 100644
138
+ --- a/onnx/defs/schema.h
139
+ +++ b/onnx/defs/schema.h
140
+ @@ -980,10 +980,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
141
+ class OpSchemaRegisterOnce final {
142
+ public:
143
+ // Export to cpp custom register macro
144
+ - explicit OpSchemaRegisterOnce(
145
+ - OpSchema op_schema,
146
+ - int opset_version_to_load = 0,
147
+ - bool fail_duplicate_schema = true) {
148
+ + OpSchemaRegisterOnce(OpSchema op_schema, int opset_version_to_load = 0, bool fail_duplicate_schema = true) {
149
+ OpSchemaRegisterNoExcept(std::move(op_schema), opset_version_to_load, fail_duplicate_schema);
150
+ }
151
+ static void
101
152
diff --git a/onnx/onnx_pb.h b/onnx/onnx_pb.h
102
- index 0aab3e26..398ac2d6 100644
153
+ index 0aab3e26..27f32195 100644
103
154
--- a/onnx/onnx_pb.h
104
155
+++ b/onnx/onnx_pb.h
105
- @@ -47,10 +47,28 @@
156
+ @@ -47,10 +47,30 @@
106
157
#define ONNX_API ONNX_IMPORT
107
158
#endif
108
159
@@ -119,6 +170,7 @@ index 0aab3e26..398ac2d6 100644
119
170
+ #endif // defined(__has_warning)
120
171
+
121
172
+ #endif // defined(__GNUC__)
173
+ +
122
174
+
123
175
#ifdef ONNX_ML
124
176
#include "onnx/onnx-ml.pb.h"
@@ -129,5 +181,6 @@ index 0aab3e26..398ac2d6 100644
129
181
+ #if defined(__GNUC__)
130
182
+ #pragma GCC diagnostic pop
131
183
+ #endif
184
+ +
132
185
+
133
186
#endif // ! ONNX_ONNX_PB_H
0 commit comments