From 6780dfcba704bd63a391ceddce1ec42dab679d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Do=C5=82bniak?= Date: Tue, 9 Nov 2021 10:53:34 +0100 Subject: [PATCH] Update of ONNX submodule to v1.10.2 (#8383) * Update of ONNX submodule to v1.10.0 * Update of ONNX to 1.10.2 * Adaptation of the ONNX FE to ONNX 1.10 * ConstantOfShape XFAIL removal * SCEL reference model updated to the new ONNX functions expansion behavior * UnXFAIL more ONNX tests * UnXFAIL even more ONNX tests --- .../onnx_common/src/onnx_model_validator.cpp | 4 +- ...ax_crossentropy_consumed_expanded.prototxt | 247 ++++++++++++++---- ngraph/test/onnx/onnx_import_library.cpp | 2 +- runtime/bindings/python/tests/__init__.py | 2 - .../python/tests/test_onnx/test_backend.py | 14 - .../python/tests_compatibility/__init__.py | 2 - .../test_onnx/test_backend.py | 14 - thirdparty/onnx/onnx | 2 +- 8 files changed, 204 insertions(+), 83 deletions(-) diff --git a/ngraph/frontend/onnx/onnx_common/src/onnx_model_validator.cpp b/ngraph/frontend/onnx/onnx_common/src/onnx_model_validator.cpp index ee75cf47991..b6395ddf3f8 100644 --- a/ngraph/frontend/onnx/onnx_common/src/onnx_model_validator.cpp +++ b/ngraph/frontend/onnx/onnx_common/src/onnx_model_validator.cpp @@ -22,7 +22,8 @@ enum Field { GRAPH = 7, OPSET_IMPORT = 8, METADATA_PROPS = 14, - TRAINING_INFO = 20 + TRAINING_INFO = 20, + FUNCTIONS = 25 }; enum WireType { VARINT = 0, BITS_64 = 1, LENGTH_DELIMITED = 2, START_GROUP = 3, END_GROUP = 4, BITS_32 = 5 }; @@ -46,6 +47,7 @@ bool is_correct_onnx_field(const PbKey& decoded_key) { {OPSET_IMPORT, LENGTH_DELIMITED}, {METADATA_PROPS, LENGTH_DELIMITED}, {TRAINING_INFO, LENGTH_DELIMITED}, + {FUNCTIONS, LENGTH_DELIMITED}, }; if (!onnx_fields.count(static_cast(decoded_key.first))) { diff --git a/ngraph/test/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt b/ngraph/test/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt index 307c80d8d5b..70214b9957b 100644 --- a/ngraph/test/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt +++ b/ngraph/test/models/onnx/transformations/reference/softmax_crossentropy_consumed_expanded.prototxt @@ -2,58 +2,80 @@ ir_version: 7 producer_name: "nGraph ONNX Importer" graph { node { - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0axes" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640Shape3D" op_type: "Constant" attribute { name: "value" t { - dims: 1 + dims: 3 data_type: 7 - int64_data: 1 + int64_data: 0 + int64_data: 0 + int64_data: -1 } type: TENSOR } + domain: "" } node { input: "x" - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Max" - op_type: "ReduceMax" + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640Shape3D" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_NCD" + op_type: "Reshape" + domain: "" + } + node { + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_NCD" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_NDC" + op_type: "Transpose" attribute { - name: "axes" + name: "perm" + ints: 0 + ints: 2 ints: 1 type: INTS } + domain: "" + } + node { + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_NDC" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_LogSM" + op_type: "LogSoftmax" + attribute { + name: "axis" + i: 2 + type: INT + } + domain: "" + } + node { + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_LogSM" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_LogSM_NCD" + op_type: "Transpose" + attribute { + name: "perm" + ints: 0 + ints: 2 + ints: 1 + type: INTS + } + domain: "" } node { input: "x" - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Max" - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Sub" - op_type: "Sub" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_shape" + op_type: "Shape" + domain: "" } node { - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Sub" - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Exp" - op_type: "Exp" + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_LogSM_NCD" + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_shape" + output: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_Log" + op_type: "Reshape" + domain: "" } node { - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Exp" - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0axes" - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_RS" - op_type: "ReduceSum" - } - node { - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Exp" - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_RS" - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Div" - op_type: "Div" - } - node { - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Div" - output: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Log" - op_type: "Log" - } - node { - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0const_zero" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640const_zero" op_type: "Constant" attribute { name: "value" @@ -64,9 +86,10 @@ graph { } type: TENSOR } + domain: "" } node { - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0const_one" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640const_one" op_type: "Constant" attribute { name: "value" @@ -77,9 +100,10 @@ graph { } type: TENSOR } + domain: "" } node { - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0axes" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640axes" op_type: "Constant" attribute { name: "value" @@ -90,45 +114,51 @@ graph { } type: TENSOR } + domain: "" } node { input: "y" - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0axes" - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0expanded_target" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640axes" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640expanded_target" op_type: "Unsqueeze" + domain: "" } node { - input: "Func_SoftmaxCrossEntropyLoss0x557617acabe0X_Log" - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0expanded_target" - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0input_gather_element" + input: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_Log" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640expanded_target" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640input_gather_element" op_type: "GatherElements" attribute { name: "axis" i: 1 type: INT } + domain: "" } node { - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0input_gather_element" - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0loss_NCdd" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640input_gather_element" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640loss_NCdd" op_type: "Neg" + domain: "" } node { - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0loss_NCdd" - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0const_zero" - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0const_one" - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0const_one" - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0loss_N1dd" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640loss_NCdd" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640const_zero" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640const_one" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640const_one" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640loss_N1dd" op_type: "Slice" + domain: "" } node { - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0loss_N1dd" - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0axes" - output: "Func_NegativeLogLikelihoodLoss0x557617d1bba0loss_Ndd" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640loss_N1dd" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640axes" + output: "Func_NegativeLogLikelihoodLoss0x7ffe150df640loss_Ndd" op_type: "Squeeze" + domain: "" } node { - input: "Func_NegativeLogLikelihoodLoss0x557617d1bba0loss_Ndd" + input: "Func_NegativeLogLikelihoodLoss0x7ffe150df640loss_Ndd" output: "z" op_type: "ReduceMean" attribute { @@ -136,6 +166,7 @@ graph { i: 0 type: INT } + domain: "" } node { input: "z" @@ -186,6 +217,126 @@ graph { } } } + value_info { + name: "z" + type { + tensor_type { + elem_type: 1 + shape { + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640Shape3D" + type { + tensor_type { + elem_type: 7 + shape { + dim { + dim_value: 3 + } + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_NCD" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 5 + } + dim { + dim_value: 1 + } + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_NDC" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 1 + } + dim { + dim_value: 5 + } + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_LogSM" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 1 + } + dim { + dim_value: 5 + } + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_LogSM_NCD" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 5 + } + dim { + dim_value: 1 + } + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_shape" + type { + tensor_type { + elem_type: 7 + shape { + dim { + dim_value: 2 + } + } + } + } + } + value_info { + name: "Func_SoftmaxCrossEntropyLoss0x7ffe150df640X_Log" + type { + tensor_type { + elem_type: 1 + } + } + } } opset_import { version: 13 diff --git a/ngraph/test/onnx/onnx_import_library.cpp b/ngraph/test/onnx/onnx_import_library.cpp index 61df4cf84e3..0968e592957 100644 --- a/ngraph/test/onnx/onnx_import_library.cpp +++ b/ngraph/test/onnx/onnx_import_library.cpp @@ -21,7 +21,7 @@ NGRAPH_TEST(onnx, check_ir_version_support) { // // The last step is to also update the details::onnx::contains_onnx_model_keys() function // in the same file to make sure that prototxt format validation also covers the changes in ONNX - EXPECT_EQ(ONNX_NAMESPACE::Version::IR_VERSION, 7) + EXPECT_EQ(ONNX_NAMESPACE::Version::IR_VERSION, 8) << "The IR_VERSION defined in ONNX does not match the version that OpenVINO supports. " "Please check the source code of this test for details and explanation how to proceed."; } diff --git a/runtime/bindings/python/tests/__init__.py b/runtime/bindings/python/tests/__init__.py index 2ed2779a0de..ba8827dcaea 100644 --- a/runtime/bindings/python/tests/__init__.py +++ b/runtime/bindings/python/tests/__init__.py @@ -108,8 +108,6 @@ xfail_issue_36538 = xfail_test(reason="RuntimeError: Check 'PartialShape::broadc "/openvino/ngraph/src/ngraph/op/util/elementwise_args.cpp:48:") xfail_issue_39658 = xfail_test(reason="RuntimeError: Tile operation has a form that is not supported." " z should be converted to TileIE operation.") -xfail_issue_39659 = xfail_test(reason="RuntimeError: Broadcast operation has a form that is not supported." - " y should be converted to Tile operation.") xfail_issue_39662 = xfail_test(reason="RuntimeError: 'ScatterElementsUpdate' layer with name 'y' have " "indices value that points to non-existing output tensor element") diff --git a/runtime/bindings/python/tests/test_onnx/test_backend.py b/runtime/bindings/python/tests/test_onnx/test_backend.py index dc7acd38d6f..b63d6cae386 100644 --- a/runtime/bindings/python/tests/test_onnx/test_backend.py +++ b/runtime/bindings/python/tests/test_onnx/test_backend.py @@ -29,7 +29,6 @@ from tests import ( xfail_issue_38734, xfail_issue_38735, xfail_issue_39658, - xfail_issue_39659, xfail_issue_39662, xfail_issue_44854, xfail_issue_44858, @@ -139,10 +138,6 @@ tests_expected_to_fail = [ "OnnxBackendNodeModelTest.test_tile_cpu", "OnnxBackendNodeModelTest.test_tile_precomputed_cpu", ), - ( - xfail_issue_39659, - "OnnxBackendNodeModelTest.test_constantofshape_int_shape_zero_cpu", - ), ( xfail_issue_39662, "OnnxBackendNodeModelTest.test_scatter_elements_with_negative_indices_cpu", @@ -250,15 +245,6 @@ tests_expected_to_fail = [ "OnnxBackendNodeModelTest.test_resize_downsample_scales_cubic_align_corners_cpu", "OnnxBackendNodeModelTest.test_resize_downsample_scales_cubic_A_n0p5_exclude_outside_cpu", "OnnxBackendNodeModelTest.test_resize_upsample_scales_cubic_A_n0p5_exclude_outside_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_cubic_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_floor_align_corners_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_ceil_half_pixel_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_cubic_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_linear_pytorch_half_pixel_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_nearest_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_nearest_tf_half_pixel_for_nn_cpu", ), ( xfail_issue_33581, diff --git a/runtime/bindings/python/tests_compatibility/__init__.py b/runtime/bindings/python/tests_compatibility/__init__.py index 6c7f8d61f34..4def045abc2 100644 --- a/runtime/bindings/python/tests_compatibility/__init__.py +++ b/runtime/bindings/python/tests_compatibility/__init__.py @@ -114,8 +114,6 @@ xfail_issue_36538 = xfail_test(reason="RuntimeError: Check 'PartialShape::broadc "/openvino/ngraph/src/ngraph/op/util/elementwise_args.cpp:48:") xfail_issue_39658 = xfail_test(reason="RuntimeError: Tile operation has a form that is not supported." " z should be converted to TileIE operation.") -xfail_issue_39659 = xfail_test(reason="RuntimeError: Broadcast operation has a form that is not supported." - " y should be converted to Tile operation.") xfail_issue_39662 = xfail_test(reason="RuntimeError: 'ScatterElementsUpdate' layer with name 'y' have " "indices value that points to non-existing output tensor element") diff --git a/runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py b/runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py index fe34d4cbf06..f5f4b7aa4bb 100644 --- a/runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py +++ b/runtime/bindings/python/tests_compatibility/test_onnx/test_backend.py @@ -28,7 +28,6 @@ from tests_compatibility import ( xfail_issue_38734, xfail_issue_38735, xfail_issue_39658, - xfail_issue_39659, xfail_issue_39662, xfail_issue_44854, xfail_issue_44858, @@ -128,10 +127,6 @@ tests_expected_to_fail = [ "OnnxBackendNodeModelTest.test_tile_cpu", "OnnxBackendNodeModelTest.test_tile_precomputed_cpu", ), - ( - xfail_issue_39659, - "OnnxBackendNodeModelTest.test_constantofshape_int_shape_zero_cpu", - ), ( xfail_issue_39662, "OnnxBackendNodeModelTest.test_scatter_elements_with_negative_indices_cpu", @@ -239,15 +234,6 @@ tests_expected_to_fail = [ "OnnxBackendNodeModelTest.test_resize_downsample_scales_cubic_align_corners_cpu", "OnnxBackendNodeModelTest.test_resize_downsample_scales_cubic_A_n0p5_exclude_outside_cpu", "OnnxBackendNodeModelTest.test_resize_upsample_scales_cubic_A_n0p5_exclude_outside_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_cubic_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_floor_align_corners_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_nearest_ceil_half_pixel_cpu", - "OnnxBackendNodeModelTest.test_resize_upsample_sizes_cubic_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_linear_pytorch_half_pixel_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_nearest_cpu", - "OnnxBackendNodeModelTest.test_resize_downsample_sizes_nearest_tf_half_pixel_for_nn_cpu", ), ( xfail_issue_33581, diff --git a/thirdparty/onnx/onnx b/thirdparty/onnx/onnx index 1089b9e8045..da889e6b957 160000 --- a/thirdparty/onnx/onnx +++ b/thirdparty/onnx/onnx @@ -1 +1 @@ -Subproject commit 1089b9e8045a3a2882d7bb6a1dbaeaf9cae131da +Subproject commit da889e6b95750350726d149bf447bf0cd1245964