OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[ONNX FE] Add MaxUnpool operation support (#38476)
Evgeny Kotov0808f308ed70
diff --git a/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst b/docs/articles_en/documentation/compatibility-and-support/supported-operations.rstindex 4bc896d76d9..1d4bf4199c0 100644--- a/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst+++ b/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst@@ -171,6 +171,7 @@ Data as of OpenVINO 2025.4.1 (December 18, 2025).MaxMaxPoolMaxRoiPool+ MaxUnpoolMeanMeanVarianceNormalizationMindiff --git a/src/frontends/onnx/docs/supported_ops.md b/src/frontends/onnx/docs/supported_ops.mdindex 1166a551115..39569468265 100644--- a/src/frontends/onnx/docs/supported_ops.md+++ b/src/frontends/onnx/docs/supported_ops.md@@ -109,7 +109,7 @@ OpenVINO provides support for operations of Default Opset (empty in table below)| |Max |8, 1 |13, 12, 8, 6, 1 | || |MaxPool |8, 1 |22, 12, 11, 10, 8, 1 | || |MaxRoiPool |1 |22, 1 | |-| |MaxUnpool | |22, 11, 9 | |+| |MaxUnpool |9 |22, 11, 9 | || |Mean |1 |13, 8, 6, 1 | || |MeanVarianceNormalization |9, 1 |13, 9 | || |MelWeightMatrix | |17 | |diff --git a/src/frontends/onnx/frontend/sources.cmake b/src/frontends/onnx/frontend/sources.cmakeindex f3a821ea80e..08ed4ef0994 100644--- a/src/frontends/onnx/frontend/sources.cmake+++ b/src/frontends/onnx/frontend/sources.cmake@@ -132,6 +132,7 @@ set(op_list${CMAKE_CURRENT_LIST_DIR}/src/op/max.cpp${CMAKE_CURRENT_LIST_DIR}/src/op/max_pool.cpp${CMAKE_CURRENT_LIST_DIR}/src/op/max_roi_pool.cpp+ ${CMAKE_CURRENT_LIST_DIR}/src/op/max_unpool.cpp${CMAKE_CURRENT_LIST_DIR}/src/op/mean.cpp${CMAKE_CURRENT_LIST_DIR}/src/op/mean_variance_normalization.cpp${CMAKE_CURRENT_LIST_DIR}/src/op/min.cppdiff --git a/src/frontends/onnx/frontend/src/op/max_unpool.cpp b/src/frontends/onnx/frontend/src/op/max_unpool.cppnew file mode 100644index 00000000000..39ea28e728d--- /dev/null+++ b/src/frontends/onnx/frontend/src/op/max_unpool.cpp@@ -0,0 +1,190 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include <algorithm>+#include <limits>++#include "core/operator_set.hpp"+#include "exceptions.hpp"+#include "openvino/op/add.hpp"+#include "openvino/op/broadcast.hpp"+#include "openvino/op/concat.hpp"+#include "openvino/op/constant.hpp"+#include "openvino/op/convert_like.hpp"+#include "openvino/op/multiply.hpp"+#include "openvino/op/reduce_prod.hpp"+#include "openvino/op/reshape.hpp"+#include "openvino/op/scatter_elements_update.hpp"+#include "openvino/op/shape_of.hpp"+#include "openvino/op/variadic_split.hpp"+#include "openvino/util/common_util.hpp"+#include "openvino/util/math_util.hpp"+#include "utils/common.hpp"++using namespace ov::op;++namespace ov::frontend::onnx::ai_onnx::opset_9 {+ov::OutputVector max_unpool(const ov::frontend::onnx::Node& node) {+ common::default_op_checks(node, 2, 3);+ const auto inputs = node.get_ov_inputs();+ const auto& data = inputs[0];+ const auto& indices = inputs[1];++ const auto kernel_shape = node.get_attribute_value<std::vector<int64_t>>("kernel_shape");+ const auto spatial_rank = kernel_shape.size();+ const auto strides =+ node.get_attribute_value<std::vector<int64_t>>("strides", std::vector<int64_t>(spatial_rank, 1));+ const auto pads = node.get_attribute_value<std::vector<int64_t>>("pads", std::vector<int64_t>(spatial_rank * 2, 0));++ // The bound keeps 'k - s - pb - pe' far from int64 overflow+ static constexpr int64_t max_value = std::numeric_limits<int32_t>::max();+ const auto is_positive = [](int64_t v) {+ return v > 0 && v <= max_value;+ };+ const auto is_non_negative = [](int64_t v) {+ return v >= 0 && v <= max_value;+ };+ CHECK_VALID_NODE(node,+ spatial_rank > 0 && std::all_of(kernel_shape.begin(), kernel_shape.end(), is_positive),+ "MaxUnpool 'kernel_shape' attribute must be non-empty and positive (<= INT32_MAX). Got: ",+ ov::util::vector_to_string(kernel_shape));+ CHECK_VALID_NODE(node,+ strides.size() == spatial_rank && std::all_of(strides.begin(), strides.end(), is_positive),+ "MaxUnpool 'strides' attribute must have ",+ spatial_rank,+ " positive (<= INT32_MAX) elements. Got: ",+ ov::util::vector_to_string(strides));+ CHECK_VALID_NODE(node,+ pads.size() == spatial_rank * 2 && std::all_of(pads.begin(), pads.end(), is_non_negative),+ "MaxUnpool 'pads' attribute must have ",+ spatial_rank * 2,+ " non-negative (<= INT32_MAX) elements. Got: ",+ ov::util::vector_to_string(pads));+ const auto data_rank = data.get_partial_shape().rank();+ CHECK_VALID_NODE(node,+ data_rank.is_dynamic() || data_rank.get_length() == static_cast<int64_t>(spatial_rank + 2),+ "MaxUnpool input rank must be 'kernel_shape' size + 2. Got rank: ",+ data_rank,+ ", 'kernel_shape' size: ",+ spatial_rank);++ CHECK_VALID_NODE(node,+ data.get_partial_shape().compatible(indices.get_partial_shape()),+ "MaxUnpool 'indices' shape must match the input shape. Got: ",+ indices.get_partial_shape(),+ " and ",+ data.get_partial_shape());++ // out[i] = (in[i] - 1) * strides[i] + kernel_shape[i] - pads_begin[i] - pads_end[i]+ std::vector<int64_t> shift(spatial_rank);+ for (size_t i = 0; i < spatial_rank; ++i) {+ shift[i] = kernel_shape[i] - strides[i] - pads[i] - pads[i + spatial_rank];+ }++ // Static output shapes are checked here, the graph arithmetic does not detect overflow+ const auto checked_size = [&node](const std::vector<int64_t>& dims) {+ int64_t size = 1;+ for (const auto dim : dims) {+ CHECK_VALID_NODE(node,+ !ov::util::mul_overflow(size, dim, size),+ "MaxUnpool output size overflows int64. Got shape: ",+ ov::util::vector_to_string(dims));+ }+ return size;+ };+ const auto& data_shape = data.get_partial_shape();+ std::vector<int64_t> inferred_dims;+ if (data_shape.is_static()) {+ inferred_dims = {data_shape[0].get_length(), data_shape[1].get_length()};+ }+ for (size_t i = 0; i < spatial_rank && data_shape.rank().is_static(); ++i) {+ if (data_shape[i + 2].is_dynamic()) {+ continue;+ }+ int64_t dim = 0;+ const bool overflow = ov::util::mul_overflow(data_shape[i + 2].get_length(), strides[i], dim) ||+ ov::util::add_overflow(dim, shift[i], dim);+ CHECK_VALID_NODE(node,+ !overflow && dim > 0,+ "MaxUnpool inferred output dimension must be positive and fit in int64. Got input shape: ",+ data_shape);+ if (!inferred_dims.empty()) {+ inferred_dims.push_back(dim);+ }+ }+ const auto inferred_size = inferred_dims.empty() ? int64_t{-1} : checked_size(inferred_dims);++ ov::Output<ov::Node> output_shape;+ if (common::is_input_valid(node, 2)) {+ output_shape = inputs[2];+ // A runtime 'output_shape' can only be checked by its shape+ const auto& os_shape = output_shape.get_partial_shape();+ CHECK_VALID_NODE(+ node,+ os_shape.rank().is_dynamic() ||+ (os_shape.rank().get_length() == 1 &&+ (os_shape[0].is_dynamic() || os_shape[0].get_length() == static_cast<int64_t>(spatial_rank + 2))),+ "MaxUnpool 'output_shape' must be a 1D tensor with ",+ spatial_rank + 2,+ " elements. Got shape: ",+ os_shape);+ if (const auto os_const = ov::as_type_ptr<v0::Constant>(output_shape.get_node_shared_ptr())) {+ const auto values = os_const->cast_vector<int64_t>();+ CHECK_VALID_NODE(node,+ std::all_of(values.begin(),+ values.end(),+ [](int64_t v) {+ return v >= 0;+ }),+ "MaxUnpool 'output_shape' must be non-negative. Got: ",+ ov::util::vector_to_string(values));+ for (size_t i = 0; i < 2 && data_shape.rank().is_static(); ++i) {+ CHECK_VALID_NODE(node,+ data_shape[i].is_dynamic() || data_shape[i].get_length() == values[i],+ "MaxUnpool 'output_shape' batch and channel dimensions must match the input. Got: ",+ ov::util::vector_to_string(values),+ " for input shape ",+ data_shape);+ }+ CHECK_VALID_NODE(node,+ checked_size(values) >= inferred_size,+ "MaxUnpool 'output_shape' must not be smaller than the inferred shape. Got: ",+ ov::util::vector_to_string(values),+ ", inferred: ",+ ov::util::vector_to_string(inferred_dims));+ }+ } else {+ const auto shape_of = std::make_shared<v3::ShapeOf>(data, ov::element::i64);+ // [N, C] and spatial dims+ const auto split = std::make_shared<v1::VariadicSplit>(shape_of,+ v0::Constant::create(ov::element::i64, {}, {0}),+ v0::Constant::create(ov::element::i64, {2}, {2, -1}));+ const auto scaled =+ std::make_shared<v1::Multiply>(split->output(1),+ v0::Constant::create(ov::element::i64, {spatial_rank}, strides));+ const auto out_spatial =+ std::make_shared<v1::Add>(scaled, v0::Constant::create(ov::element::i64, {spatial_rank}, shift));+ output_shape = std::make_shared<v0::Concat>(ov::OutputVector{split->output(0), out_spatial}, 0);+ }++ // Indices address flat(N x C x D1 x ... x Dn)+ const auto zero = std::make_shared<v1::ConvertLike>(v0::Constant::create(ov::element::f32, {}, {0}), data);+ const auto total_size =+ std::make_shared<v1::ReduceProd>(output_shape, v0::Constant::create(ov::element::i64, {1}, {0}), true);+ const auto zeros = std::make_shared<v3::Broadcast>(zero, total_size);+ const auto flat_shape = v0::Constant::create(ov::element::i64, {1}, {-1});+ const auto flat_data = std::make_shared<v1::Reshape>(data, flat_shape, false);+ const auto flat_indices = std::make_shared<v1::Reshape>(indices, flat_shape, false);+ const auto scattered = std::make_shared<v12::ScatterElementsUpdate>(zeros,+ flat_indices,+ flat_data,+ v0::Constant::create(ov::element::i64, {}, {0}),+ v12::ScatterElementsUpdate::Reduction::NONE);+ return {std::make_shared<v1::Reshape>(scattered, output_shape, false)};+}++// MaxUnpool is defined since opset 9, but it is registered since opset 1,+// because OperatorsBridge requires a translator for every version imported by a model.+ONNX_OP("MaxUnpool", OPSET_SINCE(1), ai_onnx::opset_9::max_unpool);+} // namespace ov::frontend::onnx::ai_onnx::opset_9diff --git a/src/frontends/onnx/tests/__init__.py b/src/frontends/onnx/tests/__init__.pyindex 6fe528ae008..5ce757e6872 100644--- a/src/frontends/onnx/tests/__init__.py+++ b/src/frontends/onnx/tests/__init__.py@@ -28,8 +28,11 @@ xfail_accuracy = xfail_test(reason="Accuracy")xfail_issue_69444 = xfail_test(reason="ONNX Resize - AssertionError: Mismatched elements.")skip_issue_67415 = pytest.mark.skip(reason="RuntimeError: Unsupported data type for when filling blob!")xfail_issue_67415 = xfail_test(reason="RuntimeError: Unsupported data type for when filling blob!")-xfail_issue_33488 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "- "MaxUnpool")+xfail_maxunpool_output_shape_onnx_ref = xfail_test(reason="MaxUnpool with output_shape: ONNX reference data places "+ "values in the inferred shape, onnxruntime and OV index "+ "flat(output_shape) (onnx/onnx#2398)")+# GPU: wrong scatter result for a static rank-1 Constant data input+skip_maxunpool_gpu = pytest.mark.skip_on_gpuskip_issue_38084 = pytest.mark.skip(reason="Aborted (core dumped) Assertion ""`(layer->get_output_partial_shape(i).is_static())' failed.")xfail_issue_33596 = xfail_test(reason="RuntimeError: OV does not support different sequence operations: "diff --git a/src/frontends/onnx/tests/models/dynamic_shapes/max_unpool_2d_dyn.prototxt b/src/frontends/onnx/tests/models/dynamic_shapes/max_unpool_2d_dyn.prototxtnew file mode 100644index 00000000000..560e452e029--- /dev/null+++ b/src/frontends/onnx/tests/models/dynamic_shapes/max_unpool_2d_dyn.prototxt@@ -0,0 +1,187 @@+ir_version: 6+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "X_dyn"+ input: "I_dyn"+ output: "Y_dyn"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_oshape"+ input: "I_oshape"+ input: "output_shape_oshape"+ output: "Y_oshape"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ name: "compute_graph"+ input {+ name: "X_dyn"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "N"+ }+ dim {+ dim_param: "C"+ }+ dim {+ dim_param: "H"+ }+ dim {+ dim_param: "W"+ }+ }+ }+ }+ }+ input {+ name: "I_dyn"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_param: "N"+ }+ dim {+ dim_param: "C"+ }+ dim {+ dim_param: "H"+ }+ dim {+ dim_param: "W"+ }+ }+ }+ }+ }+ input {+ name: "X_oshape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_oshape"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "output_shape_oshape"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ output {+ name: "Y_dyn"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "N"+ }+ dim {+ dim_param: "C"+ }+ dim {+ dim_param: "OH"+ }+ dim {+ dim_param: "OW"+ }+ }+ }+ }+ }+ output {+ name: "Y_oshape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 11+}diff --git a/src/frontends/onnx/tests/models/max_unpool.prototxt b/src/frontends/onnx/tests/models/max_unpool.prototxtnew file mode 100644index 00000000000..4079c9f1c77--- /dev/null+++ b/src/frontends/onnx/tests/models/max_unpool.prototxt@@ -0,0 +1,611 @@+ir_version: 6+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "X_1d"+ input: "I_1d"+ output: "Y_1d"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_3d"+ input: "I_3d"+ output: "Y_3d"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_pads"+ input: "I_pads"+ output: "Y_pads"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 3+ ints: 3+ type: INTS+ }+ attribute {+ name: "pads"+ ints: 1+ ints: 1+ ints: 1+ ints: 1+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_default_strides"+ input: "I_default_strides"+ output: "Y_default_strides"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_batch_channels"+ input: "I_batch_channels"+ output: "Y_batch_channels"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_oshape"+ input: "I_oshape"+ input: "output_shape_oshape"+ output: "Y_oshape"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_round_trip"+ output: "P_round_trip"+ output: "Ind_round_trip"+ op_type: "MaxPool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_round_trip"+ output: "S_round_trip"+ op_type: "Shape"+ }+ node {+ input: "P_round_trip"+ input: "Ind_round_trip"+ input: "S_round_trip"+ output: "Y_round_trip"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ name: "compute_graph"+ initializer {+ dims: 4+ data_type: 7+ int64_data: 1+ int64_data: 1+ int64_data: 5+ int64_data: 5+ name: "output_shape_oshape"+ }+ input {+ name: "X_1d"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ input {+ name: "I_1d"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ input {+ name: "X_3d"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_3d"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 3+ }+ }+ }+ }+ }+ input {+ name: "I_pads"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 3+ }+ }+ }+ }+ }+ input {+ name: "X_default_strides"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 3+ }+ }+ }+ }+ }+ input {+ name: "I_default_strides"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 3+ }+ }+ }+ }+ }+ input {+ name: "X_batch_channels"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_batch_channels"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_oshape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_oshape"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_round_trip"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 5+ }+ dim {+ dim_value: 5+ }+ }+ }+ }+ }+ output {+ name: "Y_1d"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 8+ }+ }+ }+ }+ }+ output {+ name: "Y_3d"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ output {+ name: "Y_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 5+ }+ dim {+ dim_value: 5+ }+ }+ }+ }+ }+ output {+ name: "Y_default_strides"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ output {+ name: "Y_batch_channels"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ output {+ name: "Y_oshape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 5+ }+ dim {+ dim_value: 5+ }+ }+ }+ }+ }+ output {+ name: "Y_round_trip"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 5+ }+ dim {+ dim_value: 5+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 11+}diff --git a/src/frontends/onnx/tests/models/max_unpool_2d_opset22.prototxt b/src/frontends/onnx/tests/models/max_unpool_2d_opset22.prototxtnew file mode 100644index 00000000000..0643135ba95--- /dev/null+++ b/src/frontends/onnx/tests/models/max_unpool_2d_opset22.prototxt@@ -0,0 +1,177 @@+ir_version: 10+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "X"+ input: "I"+ output: "Y"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_f16"+ input: "I_f16"+ output: "Y_f16"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ name: "compute_graph"+ input {+ name: "X"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_f16"+ type {+ tensor_type {+ elem_type: 10+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_f16"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ output {+ name: "Y"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ output {+ name: "Y_f16"+ type {+ tensor_type {+ elem_type: 10+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 22+}diff --git a/src/frontends/onnx/tests/models/max_unpool_2d_opset9.prototxt b/src/frontends/onnx/tests/models/max_unpool_2d_opset9.prototxtnew file mode 100644index 00000000000..b2ebd8d293d--- /dev/null+++ b/src/frontends/onnx/tests/models/max_unpool_2d_opset9.prototxt@@ -0,0 +1,93 @@+ir_version: 4+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "X"+ input: "I"+ output: "Y"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ name: "compute_graph"+ input {+ name: "X"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ output {+ name: "Y"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 9+}diff --git a/src/frontends/onnx/tests/models/max_unpool_validation.prototxt b/src/frontends/onnx/tests/models/max_unpool_validation.prototxtnew file mode 100644index 00000000000..16eca3a8547--- /dev/null+++ b/src/frontends/onnx/tests/models/max_unpool_validation.prototxt@@ -0,0 +1,1225 @@+ir_version: 6+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "X_kernel_shape"+ input: "I_kernel_shape"+ output: "Y_kernel_shape"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 0+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_strides"+ input: "I_strides"+ output: "Y_strides"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_pads"+ input: "I_pads"+ output: "Y_pads"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "pads"+ ints: 1+ ints: 1+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_negative_pads"+ input: "I_negative_pads"+ output: "Y_negative_pads"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "pads"+ ints: 0+ ints: -1+ ints: 0+ ints: 0+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_huge_pads"+ input: "I_huge_pads"+ output: "Y_huge_pads"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "pads"+ ints: 9223372036854775807+ ints: 9223372036854775807+ ints: 0+ ints: 0+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_rank"+ input: "I_rank"+ output: "Y_rank"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_output_shape_rank"+ input: "I_output_shape_rank"+ input: "output_shape_output_shape_rank"+ output: "Y_output_shape_rank"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_output_shape_channels"+ input: "I_output_shape_channels"+ input: "output_shape_output_shape_channels"+ output: "Y_output_shape_channels"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_indices_shape"+ input: "I_indices_shape"+ output: "Y_indices_shape"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_large_dim"+ input: "I_large_dim"+ input: "output_shape_large_dim"+ output: "Y_large_dim"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_size_overflow"+ input: "I_size_overflow"+ output: "Y_size_overflow"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2147483647+ ints: 2147483647+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2147483647+ ints: 2147483647+ type: INTS+ }+ }+ node {+ input: "X_output_shape_overflow"+ input: "I_output_shape_overflow"+ input: "output_shape_output_shape_overflow"+ output: "Y_output_shape_overflow"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ node {+ input: "X_non_positive_dim"+ input: "I_non_positive_dim"+ output: "Y_non_positive_dim"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 3+ ints: 3+ type: INTS+ }+ attribute {+ name: "pads"+ ints: 2+ ints: 2+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 1+ ints: 1+ type: INTS+ }+ }+ node {+ input: "X_output_shape_small"+ input: "I_output_shape_small"+ input: "output_shape_output_shape_small"+ output: "Y_output_shape_small"+ op_type: "MaxUnpool"+ attribute {+ name: "kernel_shape"+ ints: 2+ ints: 2+ type: INTS+ }+ attribute {+ name: "strides"+ ints: 2+ ints: 2+ type: INTS+ }+ }+ name: "compute_graph"+ initializer {+ dims: 3+ data_type: 7+ int64_data: 1+ int64_data: 1+ int64_data: 4+ name: "output_shape_output_shape_rank"+ }+ initializer {+ dims: 4+ data_type: 7+ int64_data: 1+ int64_data: 2+ int64_data: 4+ int64_data: 4+ name: "output_shape_output_shape_channels"+ }+ initializer {+ dims: 4+ data_type: 7+ int64_data: 1+ int64_data: 1+ int64_data: 4294967296+ int64_data: 4+ name: "output_shape_large_dim"+ }+ initializer {+ dims: 4+ data_type: 7+ int64_data: 1+ int64_data: 1+ int64_data: 4294967296+ int64_data: 4294967296+ name: "output_shape_output_shape_overflow"+ }+ initializer {+ dims: 4+ data_type: 7+ int64_data: 1+ int64_data: 1+ int64_data: 2+ int64_data: 2+ name: "output_shape_output_shape_small"+ }+ input {+ name: "X_kernel_shape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_kernel_shape"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_strides"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_strides"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_pads"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_negative_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_negative_pads"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_huge_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_huge_pads"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_rank"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_rank"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_output_shape_rank"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_output_shape_rank"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_output_shape_channels"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_output_shape_channels"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_indices_shape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 3+ }+ }+ }+ }+ }+ input {+ name: "I_indices_shape"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 3+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_large_dim"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_large_dim"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_size_overflow"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_size_overflow"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_output_shape_overflow"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_output_shape_overflow"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "X_non_positive_dim"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "I_non_positive_dim"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "X_output_shape_small"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ input {+ name: "I_output_shape_small"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 2+ }+ dim {+ dim_value: 2+ }+ }+ }+ }+ }+ output {+ name: "Y_kernel_shape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_strides"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_negative_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_huge_pads"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_rank"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_output_shape_rank"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_output_shape_channels"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_indices_shape"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_large_dim"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ }+ dim {+ }+ dim {+ }+ dim {+ }+ }+ }+ }+ }+ output {+ name: "Y_size_overflow"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ }+ }+ }+ }+ output {+ name: "Y_output_shape_overflow"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ }+ }+ }+ }+ output {+ name: "Y_non_positive_dim"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ }+ }+ }+ }+ output {+ name: "Y_output_shape_small"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ dim {+ dim_param: ""+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 11+}diff --git a/src/frontends/onnx/tests/onnx_import_convpool.in.cpp b/src/frontends/onnx/tests/onnx_import_convpool.in.cppindex e38c8702d92..ac6915954c4 100644--- a/src/frontends/onnx/tests/onnx_import_convpool.in.cpp+++ b/src/frontends/onnx/tests/onnx_import_convpool.in.cpp@@ -8,6 +8,7 @@#include <fstream>#include <iterator>#include <limits>+#include <map>#include <numeric>#include <sstream>#include <stdexcept>@@ -22,6 +23,8 @@#include "gtest/gtest.h"#include "onnx_utils.hpp"#include "openvino/op/max_pool.hpp"+#include "openvino/op/scatter_elements_update.hpp"+#include "openvino/op/util/framework_node.hpp"using namespace ov;using namespace ov::frontend::onnx::tests;@@ -1703,3 +1706,148 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_convtranspose_output_shape_with_batch_test_case.run();}++namespace {+// ONNX spec example+const Shape max_unpool_spec_in_shape{1, 1, 2, 2};+const Shape max_unpool_spec_out_shape{1, 1, 4, 4};+const std::vector<float> max_unpool_spec_x{5.0f, 6.0f, 7.0f, 8.0f};+const std::vector<int64_t> max_unpool_spec_indices{5, 7, 13, 15};+const std::vector<float>+ max_unpool_spec_y{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, 0.0f, 6.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 7.0f, 0.0f, 8.0f};+} // namespace++OPENVINO_TEST(${BACKEND_NAME}, onnx_model_max_unpool_2d_opset9) {+ auto test_case = ov::test::TestCase(convert_model("max_unpool_2d_opset9.onnx"), s_device);+ test_case.add_input<float>(max_unpool_spec_in_shape, max_unpool_spec_x);+ test_case.add_input<int64_t>(max_unpool_spec_in_shape, max_unpool_spec_indices);+ test_case.add_expected_output<float>(max_unpool_spec_out_shape, max_unpool_spec_y);+ test_case.run();+}++OPENVINO_TEST(${BACKEND_NAME}, onnx_model_max_unpool_2d_opset22) {+ // f32 and f16 nodes+ auto test_case = ov::test::TestCase(convert_model("max_unpool_2d_opset22.onnx"), s_device);+ test_case.add_input<float>(max_unpool_spec_in_shape, max_unpool_spec_x);+ test_case.add_input<int64_t>(max_unpool_spec_in_shape, max_unpool_spec_indices);+ test_case.add_input<ov::float16>(max_unpool_spec_in_shape,+ std::vector<ov::float16>(max_unpool_spec_x.begin(), max_unpool_spec_x.end()));+ test_case.add_input<int64_t>(max_unpool_spec_in_shape, max_unpool_spec_indices);+ test_case.add_expected_output<float>(max_unpool_spec_out_shape, max_unpool_spec_y);+ test_case.add_expected_output<ov::float16>(+ max_unpool_spec_out_shape,+ std::vector<ov::float16>(max_unpool_spec_y.begin(), max_unpool_spec_y.end()));+ test_case.run();+}++OPENVINO_TEST(${BACKEND_NAME}, onnx_model_max_unpool) {+ // Independent MaxUnpool nodes, one per case+ auto test_case = ov::test::TestCase(convert_model("max_unpool.onnx"), s_device);+ // 1d+ test_case.add_input<float>(Shape{1, 2, 4}, {1.5f, -0.5f, 3.0f, 3.5f, 0.0f, 2.5f, 2.0f, 0.5f});+ test_case.add_input<int64_t>(Shape{1, 2, 4}, {1, 2, 4, 6, 9, 11, 12, 15});+ // 3d+ test_case.add_input<float>(Shape{1, 1, 2, 2, 2}, {15.5f, 8.5f, 15.0f, 14.5f, 10.5f, 13.0f, 14.0f, 9.0f});+ test_case.add_input<int64_t>(Shape{1, 1, 2, 2, 2}, {1, 22, 8, 10, 48, 51, 61, 58});+ // pads+ test_case.add_input<float>(Shape{1, 1, 3, 3}, {5.0f, 5.0f, 3.0f, 4.5f, 6.0f, 6.0f, 2.0f, 6.0f, 6.0f});+ test_case.add_input<int64_t>(Shape{1, 1, 3, 3}, {1, 1, 3, 6, 18, 18, 20, 18, 18});+ // default strides, duplicate indices+ test_case.add_input<float>(Shape{1, 1, 3, 3}, {16.0f, 16.0f, 8.0f, 16.0f, 16.0f, 12.0f, 14.0f, 15.0f, 15.0f});+ test_case.add_input<int64_t>(Shape{1, 1, 3, 3}, {5, 5, 7, 5, 5, 11, 13, 14, 14});+ // indices include batch and channel offsets+ test_case.add_input<float>(Shape{2, 3, 2, 2},+ {12.0f, 19.5f, 21.0f, 23.5f, 17.5f, 15.0f, 22.5f, 20.5f, -6.0f, -5.0f, 23.0f, 19.0f,+ 1.5f, 8.0f, 16.0f, 3.0f, 12.5f, 18.5f, 9.0f, 20.0f, 22.0f, 10.5f, 4.5f, 21.5f});+ test_case.add_input<int64_t>(Shape{2, 3, 2, 2}, {1, 3, 8, 11, 16, 22, 28, 26, 32, 39, 40, 46,+ 49, 51, 60, 62, 65, 66, 73, 78, 84, 86, 89, 94});+ // constant output_shape, indices address flat(output_shape)+ test_case.add_input<float>(Shape{1, 1, 2, 2}, {5.5f, 2.0f, 4.5f, 0.5f});+ test_case.add_input<int64_t>(Shape{1, 1, 2, 2}, {6, 8, 11, 17});+ // MaxPool -> MaxUnpool(output_shape = Shape(X))+ test_case.add_input<float>(+ Shape{1, 2, 5, 5},+ {-3.0f, -9.0f, 11.0f, -11.0f, -8.5f, -12.5f, -2.5f, 10.5f, 12.0f, -10.0f, -2.0f, -0.5f, -8.0f,+ 8.5f, 1.0f, 2.5f, 5.5f, 6.5f, 6.0f, 2.0f, -9.5f, 10.0f, -5.5f, 8.0f, -7.0f, 3.0f,+ 0.0f, -6.0f, -3.5f, -1.0f, -6.5f, 9.0f, -12.0f, 1.5f, 3.5f, 5.0f, -7.5f, -10.5f, 4.5f,+ -1.5f, 4.0f, 7.0f, -4.5f, 9.5f, 0.5f, -11.5f, -5.0f, 11.5f, -4.0f, 7.5f});++ test_case.add_expected_output<float>(+ Shape{1, 2, 8},+ {0.0f, 1.5f, -0.5f, 0.0f, 3.0f, 0.0f, 3.5f, 0.0f, 0.0f, 0.0f, 0.0f, 2.5f, 2.0f, 0.0f, 0.0f, 0.5f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 4, 4, 4},+ {0.0f, 15.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 15.0f, 0.0f, 14.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,+ 10.5f, 0.0f, 0.0f, 13.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 9.0f, 0.0f, 0.0f, 14.0f, 0.0f, 0.0f});+ test_case.add_expected_output<float>(Shape{1, 1, 5, 5},+ {0.0f, 5.0f, 0.0f, 3.0f, 0.0f, 0.0f, 4.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 4, 4},+ {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 12.0f, 0.0f, 14.0f, 15.0f, 0.0f});+ test_case.add_expected_output<float>(+ Shape{2, 3, 4, 4},+ {0.0f, 12.0f, 0.0f, 19.5f, 0.0f, 0.0f, 0.0f, 0.0f, 21.0f, 0.0f, 0.0f, 23.5f, 0.0f, 0.0f, 0.0f, 0.0f,+ 17.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 15.0f, 0.0f, 0.0f, 0.0f, 20.5f, 0.0f, 22.5f, 0.0f, 0.0f, 0.0f,+ -6.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -5.0f, 23.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 19.0f, 0.0f,+ 0.0f, 1.5f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f, 0.0f, 3.0f, 0.0f,+ 0.0f, 12.5f, 18.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 9.0f, 0.0f, 0.0f, 0.0f, 0.0f, 20.0f, 0.0f,+ 0.0f, 0.0f, 0.0f, 0.0f, 22.0f, 0.0f, 10.5f, 0.0f, 0.0f, 4.5f, 0.0f, 0.0f, 0.0f, 0.0f, 21.5f, 0.0f});+ test_case.add_expected_output<float>(Shape{1, 1, 5, 5},+ {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.5f, 0.0f, 2.0f, 0.0f, 0.0f, 4.5f, 0.0f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f});+ test_case.add_expected_output<float>(+ Shape{1, 2, 5, 5},+ {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -2.5f, 0.0f, 12.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.5f, 0.0f, 0.0f, 5.5f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 9.0f, 0.0f, 1.5f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 7.0f, 0.0f, 9.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f});+ test_case.run();+}++OPENVINO_TEST(${BACKEND_NAME}, onnx_model_max_unpool_decomposition) {+ const auto model = convert_model("max_unpool_2d_opset9.onnx");+ const auto ops = model->get_ordered_ops();+ EXPECT_EQ(std::count_if(ops.begin(),+ ops.end(),+ [](const std::shared_ptr<ov::Node>& op) {+ return ov::is_type<op::v12::ScatterElementsUpdate>(op);+ }),+ 1);+}++OPENVINO_TEST(${BACKEND_NAME}, onnx_model_max_unpool_validation) {+ // Each invalid node becomes a framework node with its own error+ const auto model = convert_partially("max_unpool_validation.onnx");+ std::map<std::string, std::string> errors;+ for (const auto& op : model->get_ops()) {+ if (const auto fw_node = ov::as_type_ptr<ov::op::util::FrameworkNode>(op)) {+ for (const auto& attr : fw_node->get_attrs()) {+ errors[op->get_output_tensor(0).get_any_name()] += attr.second + "\n";+ }+ }+ }+ const std::map<std::string, std::string> expected{+ {"Y_kernel_shape", "'kernel_shape'"},+ {"Y_strides", "'strides'"},+ {"Y_pads", "'pads'"},+ {"Y_negative_pads", "'pads'"},+ {"Y_huge_pads", "'pads'"},+ {"Y_rank", "rank"},+ {"Y_output_shape_rank", "'output_shape'"},+ {"Y_output_shape_channels", "'output_shape'"},+ {"Y_indices_shape", "'indices'"},+ {"Y_size_overflow", "overflows int64"},+ {"Y_output_shape_overflow", "overflows int64"},+ {"Y_non_positive_dim", "inferred output dimension"},+ {"Y_output_shape_small", "smaller than the inferred"},+ };+ // Y_large_dim: a valid int64 dimension above INT32_MAX is converted+ EXPECT_EQ(errors.size(), expected.size());+ for (const auto& [output, message] : expected) {+ SCOPED_TRACE(output);+ ASSERT_EQ(errors.count(output), 1);+ EXPECT_THAT(errors.at(output), testing::HasSubstr(message));+ }+}diff --git a/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp b/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cppindex bdc998597f0..d80b233a807 100644--- a/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp+++ b/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp@@ -1248,3 +1248,47 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_batch_norm_training_mode_dyn_rank) {test_case.run();}++OPENVINO_TEST(${BACKEND_NAME}, onnx_dyn_shapes_max_unpool_2d_dyn) {+ // Y_dyn: dynamic N/C/H/W; Y_oshape: output_shape given as a runtime input+ const auto model = convert_model("dynamic_shapes/max_unpool_2d_dyn.onnx");+ for (size_t i = 0; i < 2; ++i) {+ const auto& out_shape = model->get_output_partial_shape(i);+ EXPECT_EQ(out_shape.rank(), Rank(4));+ EXPECT_TRUE(out_shape.is_dynamic());+ }++ const std::vector<float> oshape_x{6.5f, 1.5f, 9.5f, 8.0f, 9.0f, 8.5f, 2.0f, 3.5f};+ const std::vector<int64_t> oshape_indices{1, 2, 9, 15, 20, 27, 28, 30};+ const std::vector<float> oshape_y{0.0f, 6.5f, 1.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 9.5f,+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f,+ 9.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.5f, 2.0f, 0.0f,+ 3.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};+ {+ auto test_case_1 = ov::test::TestCase(model, s_device);+ test_case_1.add_input<float>(Shape{1, 1, 2, 3}, {4.0f, 0.0f, 5.0f, 5.5f, 1.5f, 2.0f});+ test_case_1.add_input<int64_t>(Shape{1, 1, 2, 3}, {6, 2, 10, 13, 14, 16});+ test_case_1.add_input<float>(Shape{1, 2, 2, 2}, oshape_x);+ test_case_1.add_input<int64_t>(Shape{1, 2, 2, 2}, oshape_indices);+ test_case_1.add_input<int64_t>(Shape{4}, {1, 2, 5, 4});+ test_case_1.add_expected_output<float>(Shape{1, 1, 4, 6}, {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f,+ 0.0f, 0.0f, 5.0f, 0.0f, 0.0f, 5.5f, 1.5f, 0.0f,+ 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f});+ test_case_1.add_expected_output<float>(Shape{1, 2, 5, 4}, oshape_y);+ test_case_1.run();+ }+ {+ auto test_case_2 = ov::test::TestCase(model, s_device);+ test_case_2.add_input<float>(Shape{2, 2, 1, 2}, {6.5f, 1.0f, 5.0f, 7.5f, 1.5f, 4.0f, 5.5f, 6.0f});+ test_case_2.add_input<int64_t>(Shape{2, 2, 1, 2}, {0, 3, 9, 10, 16, 19, 25, 27});+ test_case_2.add_input<float>(Shape{1, 2, 2, 2}, oshape_x);+ test_case_2.add_input<int64_t>(Shape{1, 2, 2, 2}, oshape_indices);+ test_case_2.add_input<int64_t>(Shape{4}, {1, 2, 5, 4});+ test_case_2.add_expected_output<float>(+ Shape{2, 2, 2, 4},+ {6.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, 7.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,+ 1.5f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.5f, 0.0f, 6.0f, 0.0f, 0.0f, 0.0f, 0.0f});+ test_case_2.add_expected_output<float>(Shape{1, 2, 5, 4}, oshape_y);+ test_case_2.run();+ }+}diff --git a/src/frontends/onnx/tests/runtime/ie/unit_test.manifest b/src/frontends/onnx/tests/runtime/ie/unit_test.manifestindex 5f01ab849c3..1ba7d34013a 100644--- a/src/frontends/onnx/tests/runtime/ie/unit_test.manifest+++ b/src/frontends/onnx/tests/runtime/ie/unit_test.manifest@@ -412,3 +412,8 @@ IE_CPU.onnx_model_dft_inverse_length_provided_onesided# CVS-195973: GPU STFT returns nondeterministic wrong frames when frame_step/frame_length are runtime inputsIE_GPU.onnx_model_stft_runtime_frame_length++# GPU: scatter ops with a rank-1 Constant input give wrong results for static shapes+IE_GPU.onnx_model_max_unpool_2d_opset9+IE_GPU.onnx_model_max_unpool_2d_opset22+IE_GPU.onnx_model_max_unpooldiff --git a/src/frontends/onnx/tests/tests_python/test_backend.py b/src/frontends/onnx/tests/tests_python/test_backend.pyindex 0b48fe6e27f..58b95863ed4 100644--- a/src/frontends/onnx/tests/tests_python/test_backend.py+++ b/src/frontends/onnx/tests/tests_python/test_backend.py@@ -9,7 +9,8 @@ import onnx.backend.testfrom tests import (BACKEND_NAME,skip_rng_tests,- xfail_issue_33488,+ xfail_maxunpool_output_shape_onnx_ref,+ skip_maxunpool_gpu,xfail_issue_33596,xfail_issue_33606,xfail_issue_33651,@@ -219,8 +220,11 @@ tests_expected_to_fail = ["OnnxBackendNodeModelTest.test_momentum_multiple_cpu",),(- xfail_issue_33488,+ xfail_maxunpool_output_shape_onnx_ref,"OnnxBackendNodeModelTest.test_maxunpool_export_with_output_shape_cpu",+ ),+ (+ skip_maxunpool_gpu,"OnnxBackendNodeModelTest.test_maxunpool_export_without_output_shape_cpu",),(