Skip to content

Commit 75e054c

Browse files
authored
pick onnx release candidate (#7177)
* pick onnx release candidate * fix typo * filter batchnorm tests * add implementation for reshape 14 * add identity op kernel for opset 14 * fix typo * update onnx commit * update commit to latest master * add hashes for new kernel registrations and update 1 * TEST commit * update onnx back to right commit * Update onnx to latest in rel-1.9.0 * temp fix * remove nonzeroshapesetter transformer * pick rel branch latest commit * fix build failures * fix build failures * fix build failures * update the commit to latest in release branch * add test filters for not impemented op14 ops in c# tests * plus review comments
1 parent d414039 commit 75e054c

File tree

21 files changed

+338
-213
lines changed

21 files changed

+338
-213
lines changed

cgmanifests/submodules/cgmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
"component": {
263263
"type": "git",
264264
"git": {
265-
"commitHash": "fe2433d3dd677ed5c582e194a49a632e707d0543",
265+
"commitHash": "971632833036c576cf95499291f689f8bb3519e1",
266266
"repositoryUrl": "https://github.com/onnx/onnx"
267267
},
268268
"comments": "git submodule at cmake/external/onnx"

cmake/external/onnx

Submodule onnx updated 130 files

csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,27 @@ private static Dictionary<string, string> GetSkippedModels(DirectoryInfo modelsD
790790
{ "test_training_dropout_default_mask", "node test error"},
791791
{ "test_min_int8", "node test error"},
792792
{ "test_cast_FLOAT_to_STRING", "node test error"},
793-
{ "test_identity_sequence", "data type not supported"}
793+
{ "test_identity_sequence", "data type not supported"},
794+
{ "test_gru_batchwise", "opset14 version not implemented yet"},
795+
{ "test_gru_defaults", "opset14 version not implemented yet"},
796+
{ "test_gru_seq_length", "opset14 version not implemented yet"},
797+
{ "test_gru_with_initial_bias", "opset14 version not implemented yet"},
798+
{ "test_lstm_batchwise", "opset14 version not implemented yet"},
799+
{ "test_lstm_defaults", "opset14 version not implemented yet"},
800+
{ "test_lstm_with_initial_bias", "opset14 version not implemented yet"},
801+
{ "test_lstm_with_peepholes", "opset14 version not implemented yet"},
802+
{ "test_rnn_seq_length", "opset14 version not implemented yet"},
803+
{ "test_simple_rnn_batchwise", "opset14 version not implemented yet"},
804+
{ "test_simple_rnn_defaults", "opset14 version not implemented yet"},
805+
{ "test_simple_rnn_with_initial_bias", "opset14 version not implemented yet"},
806+
{ "test_sub_uint8", "data type not supported"},
807+
{ "test_mul_uint8", "data type not supported"},
808+
{ "test_add_uint8", "data type not supported"},
809+
{ "test_div_uint8", "data type not supported"},
810+
{ "test_batchnorm_epsilon", "opset14 version not implemented yet"},
811+
{ "test_batchnorm_epsilon_training_mode", "opset14 version not implemented yet"},
812+
{ "test_batchnorm_example", "opset14 version not implemented yet"},
813+
{ "test_batchnorm_example_training_mode", "opset14 version not implemented yet"},
794814
};
795815

796816
// The following models fails on nocontribops win CI

onnxruntime/core/providers/cpu/cpu_execution_provider.cc

Lines changed: 96 additions & 44 deletions
Large diffs are not rendered by default.

onnxruntime/core/providers/cpu/math/element_wise_ops.cc

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,37 +162,53 @@ REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 7, 12, float, Add);
162162
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 7, 12, double, Add);
163163
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 7, 12, int32_t, Add);
164164
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 7, 12, int64_t, Add);
165-
REG_ELEMENTWISE_TYPED_KERNEL(Add, 13, float, Add);
166-
REG_ELEMENTWISE_TYPED_KERNEL(Add, 13, double, Add);
167-
REG_ELEMENTWISE_TYPED_KERNEL(Add, 13, int32_t, Add);
168-
REG_ELEMENTWISE_TYPED_KERNEL(Add, 13, int64_t, Add);
165+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 13, 13, float, Add);
166+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 13, 13, double, Add);
167+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 13, 13, int32_t, Add);
168+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Add, 13, 13, int64_t, Add);
169+
REG_ELEMENTWISE_TYPED_KERNEL(Add, 14, float, Add);
170+
REG_ELEMENTWISE_TYPED_KERNEL(Add, 14, double, Add);
171+
REG_ELEMENTWISE_TYPED_KERNEL(Add, 14, int32_t, Add);
172+
REG_ELEMENTWISE_TYPED_KERNEL(Add, 14, int64_t, Add);
169173

170174
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 7, 12, float, Sub);
171175
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 7, 12, double, Sub);
172176
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 7, 12, int32_t, Sub);
173177
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 7, 12, int64_t, Sub);
174-
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 13, float, Sub);
175-
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 13, double, Sub);
176-
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 13, int32_t, Sub);
177-
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 13, int64_t, Sub);
178+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 13, 13, float, Sub);
179+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 13, 13, double, Sub);
180+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 13, 13, int32_t, Sub);
181+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Sub, 13, 13, int64_t, Sub);
182+
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 14, float, Sub);
183+
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 14, double, Sub);
184+
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 14, int32_t, Sub);
185+
REG_ELEMENTWISE_TYPED_KERNEL(Sub, 14, int64_t, Sub);
178186

179187
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 7, 12, float, Mul);
180188
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 7, 12, double, Mul);
181189
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 7, 12, int32_t, Mul);
182190
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 7, 12, int64_t, Mul);
183-
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 13, float, Mul);
184-
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 13, double, Mul);
185-
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 13, int32_t, Mul);
186-
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 13, int64_t, Mul);
191+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 13, 13, float, Mul);
192+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 13, 13, double, Mul);
193+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 13, 13, int32_t, Mul);
194+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mul, 13, 13, int64_t, Mul);
195+
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 14, float, Mul);
196+
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 14, double, Mul);
197+
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 14, int32_t, Mul);
198+
REG_ELEMENTWISE_TYPED_KERNEL(Mul, 14, int64_t, Mul);
187199

188200
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 7, 12, float, Div);
189201
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 7, 12, double, Div);
190202
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 7, 12, int32_t, Div);
191203
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 7, 12, int64_t, Div);
192-
REG_ELEMENTWISE_TYPED_KERNEL(Div, 13, float, Div);
193-
REG_ELEMENTWISE_TYPED_KERNEL(Div, 13, double, Div);
194-
REG_ELEMENTWISE_TYPED_KERNEL(Div, 13, int32_t, Div);
195-
REG_ELEMENTWISE_TYPED_KERNEL(Div, 13, int64_t, Div);
204+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 13, 13, float, Div);
205+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 13, 13, double, Div);
206+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 13, 13, int32_t, Div);
207+
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Div, 13, 13, int64_t, Div);
208+
REG_ELEMENTWISE_TYPED_KERNEL(Div, 14, float, Div);
209+
REG_ELEMENTWISE_TYPED_KERNEL(Div, 14, double, Div);
210+
REG_ELEMENTWISE_TYPED_KERNEL(Div, 14, int32_t, Div);
211+
REG_ELEMENTWISE_TYPED_KERNEL(Div, 14, int64_t, Div);
196212

197213
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Abs, 6, 12, float, Abs);
198214
REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Abs, 6, 12, double, Abs);

onnxruntime/core/providers/cpu/tensor/identity_op.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
3131
KernelDefBuilder().TypeConstraint("T", DataTypeImpl::AllTensorTypes()).Alias(0, 0),
3232
IdentityOp<false>);
3333

34-
ONNX_CPU_OPERATOR_KERNEL(
34+
ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
3535
Identity,
3636
13,
37+
13,
38+
KernelDefBuilder().TypeConstraint("T", DataTypeImpl::AllTensorTypes()).Alias(0, 0),
39+
IdentityOp<false>);
40+
41+
ONNX_CPU_OPERATOR_KERNEL(
42+
Identity,
43+
14,
3744
KernelDefBuilder().TypeConstraint("V", DataTypeImpl::AllTensorTypes()).Alias(0, 0),
3845
IdentityOp<false>);
3946

onnxruntime/core/providers/cpu/tensor/reshape.cc

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
#include "core/providers/cpu/tensor/reshape.h"
55
namespace onnxruntime {
66

7+
ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
8+
Reshape,
9+
1,
10+
4,
11+
KernelDefBuilder()
12+
.Alias(0, 0)
13+
.TypeConstraint("T", DataTypeImpl::AllTensorTypes()),
14+
Reshape_1);
15+
716
ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
817
Reshape,
918
5,
@@ -14,22 +23,23 @@ ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
1423
.TypeConstraint("shape", DataTypeImpl::GetTensorType<int64_t>()),
1524
Reshape);
1625

17-
ONNX_CPU_OPERATOR_KERNEL(
26+
ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
1827
Reshape,
1928
13,
29+
13,
2030
KernelDefBuilder()
2131
.Alias(0, 0)
2232
.TypeConstraint("T", DataTypeImpl::AllTensorTypes())
2333
.TypeConstraint("shape", DataTypeImpl::GetTensorType<int64_t>()),
2434
Reshape);
2535

26-
ONNX_CPU_OPERATOR_VERSIONED_KERNEL(
36+
ONNX_CPU_OPERATOR_KERNEL(
2737
Reshape,
28-
1,
29-
4,
38+
14,
3039
KernelDefBuilder()
3140
.Alias(0, 0)
32-
.TypeConstraint("T", DataTypeImpl::AllTensorTypes()),
33-
Reshape_1);
41+
.TypeConstraint("T", DataTypeImpl::AllTensorTypes())
42+
.TypeConstraint("shape", DataTypeImpl::GetTensorType<int64_t>()),
43+
Reshape);
3444

3545
} // namespace onnxruntime

onnxruntime/core/providers/cpu/tensor/reshape.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace onnxruntime {
1414

1515
class Reshape final : public OpKernel {
1616
public:
17-
explicit Reshape(const OpKernelInfo& info) : OpKernel(info) {
17+
explicit Reshape(const OpKernelInfo& info) : OpKernel(info),
18+
allow_zero_(info.GetAttrOrDefault<int64_t>("allowzero", 0) == 1) {
1819
}
1920

2021
Status Compute(OpKernelContext* context) const override {
@@ -29,14 +30,17 @@ class Reshape final : public OpKernel {
2930
const auto* X = context->Input<Tensor>(0);
3031
const TensorShape& X_shape = X->Shape();
3132

32-
ReshapeHelper helper(X_shape, shape);
33+
ReshapeHelper helper(X_shape, shape, allow_zero_);
3334

3435
Tensor* Y = context->Output(0, TensorShape(shape));
3536

3637
CopyCpuTensor(X, Y);
3738

3839
return Status::OK();
3940
}
41+
42+
private:
43+
const bool allow_zero_;
4044
};
4145

4246
class Reshape_1 final : public OpKernel {

onnxruntime/core/providers/cpu/tensor/reshape_helper.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ namespace onnxruntime {
1212
// Verify and convert unknown dim during reshape
1313
class ReshapeHelper {
1414
public:
15-
ReshapeHelper(const TensorShape& input_shape, std::vector<int64_t>& requested_shape) {
15+
ReshapeHelper(const TensorShape& input_shape, std::vector<int64_t>& requested_shape, bool allow_zero = false) {
1616
auto nDims = requested_shape.size();
1717
ptrdiff_t unknown_dim = -1;
1818
int64_t size = 1;
1919
for (size_t i = 0; i < nDims; ++i) {
2020
ORT_ENFORCE(requested_shape[i] >= -1, "A dimension cannot be less than -1, got ", requested_shape[i]);
2121
if (requested_shape[i] == -1) {
22+
ORT_ENFORCE(!allow_zero,
23+
"The input tensor cannot be reshaped to the requested shape. Input shape:",
24+
input_shape, ", requested shape:", TensorShape(requested_shape));
2225
ORT_ENFORCE(unknown_dim == -1, "At most one dimension can be -1.");
2326
unknown_dim = i;
2427
} else {
25-
if (requested_shape[i] == 0) {
28+
if (!allow_zero && requested_shape[i] == 0) {
2629
ORT_ENFORCE(i < input_shape.NumDimensions(),
2730
"The dimension with value zero exceeds"
2831
" the dimension size of the input tensor.");

onnxruntime/core/providers/cuda/object_detection/non_max_suppression_impl.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ limitations under the License.
1414
==============================================================================*/
1515
/* Modifications Copyright (c) Microsoft. */
1616

17+
#include <thrust/device_vector.h>
18+
#include <thrust/execution_policy.h>
19+
1720
#include "non_max_suppression_impl.h"
1821
#include "core/providers/cpu/object_detection/non_max_suppression_helper.h"
1922
#include "core/providers/cuda/cu_inc/common.cuh"
2023
#include "core/providers/cuda/cuda_common.h"
2124

2225
#include "core/framework/tensor.h"
2326

24-
#include <thrust/device_vector.h>
25-
#include <thrust/execution_policy.h>
26-
2727
#include <cub/cub.cuh>
2828
//TODO:fix the warnings
2929
#ifdef _MSC_VER

0 commit comments

Comments
 (0)