From 44034333091fac0aacfcaa81e4265f845b884624 Mon Sep 17 00:00:00 2001 From: Mateusz Bencer Date: Tue, 28 Mar 2023 20:47:17 +0200 Subject: [PATCH] [ONNX FE] Implementation of ONNX STFT op (#16461) --- src/frontends/onnx/frontend/src/op/dft.cpp | 61 +- src/frontends/onnx/frontend/src/op/stft.cpp | 124 ++ src/frontends/onnx/frontend/src/op/stft.hpp | 22 + .../onnx/frontend/src/ops_bridge.cpp | 5 + src/frontends/onnx/frontend/src/utils/dft.cpp | 77 + src/frontends/onnx/frontend/src/utils/dft.hpp | 20 + src/frontends/onnx/tests/CMakeLists.txt | 1 + .../models/stft_dynamic_signal_shape.prototxt | 99 ++ ...input_given_window_default_length.prototxt | 85 + ...ut_given_window_no_default_length.prototxt | 101 ++ ...ex_input_no_window_default_length.prototxt | 72 + ..._input_no_window_default_length_2.prototxt | 72 + ...input_no_window_no_default_length.prototxt | 87 + ...al_input_no_window_default_length.prototxt | 72 + .../stft_non_const_frame_length.prototxt | 98 + .../models/stft_non_const_frame_step.prototxt | 99 ++ .../stft_onesided_complex_input.prototxt | 100 ++ ...ut_given_window_no_default_length.prototxt | 100 ++ ...al_input_no_window_default_length.prototxt | 67 + src/frontends/onnx/tests/onnx_import.in.cpp | 246 --- .../onnx/tests/onnx_import_signal.in.cpp | 1578 +++++++++++++++++ 21 files changed, 2886 insertions(+), 300 deletions(-) create mode 100644 src/frontends/onnx/frontend/src/op/stft.cpp create mode 100644 src/frontends/onnx/frontend/src/op/stft.hpp create mode 100644 src/frontends/onnx/frontend/src/utils/dft.cpp create mode 100644 src/frontends/onnx/frontend/src/utils/dft.hpp create mode 100644 src/frontends/onnx/tests/models/stft_dynamic_signal_shape.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_default_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_no_default_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length_2.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_no_default_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_no_onesided_real_input_no_window_default_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_non_const_frame_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_non_const_frame_step.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_onesided_complex_input.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_onesided_real_input_given_window_no_default_length.prototxt create mode 100644 src/frontends/onnx/tests/models/stft_onesided_real_input_no_window_default_length.prototxt create mode 100644 src/frontends/onnx/tests/onnx_import_signal.in.cpp diff --git a/src/frontends/onnx/frontend/src/op/dft.cpp b/src/frontends/onnx/frontend/src/op/dft.cpp index 79c3fbe0e58..28fbad5203e 100644 --- a/src/frontends/onnx/frontend/src/op/dft.cpp +++ b/src/frontends/onnx/frontend/src/op/dft.cpp @@ -4,75 +4,28 @@ #include "op/dft.hpp" -#include "default_opset.hpp" #include "onnx_import/core/null_node.hpp" #include "utils/common.hpp" +#include "utils/dft.hpp" namespace ngraph { namespace onnx_import { namespace op { namespace set_1 { - -namespace { -// For DFT, IDFT, IRDFT cases, if real data are provided (with shape [D_0, D_1, ..., D_{N-1}, 1]) -// it's needed to fill tensors with zero imaginary part to be aligned with Core ops requirements. -bool try_convert_real_to_complex(ov::Output& data) { - if (data.get_partial_shape().rank().is_static()) { - const auto length = data.get_partial_shape().rank().get_length(); - const auto last_axis_pos = length - 1; - const auto last_dim = data.get_partial_shape()[last_axis_pos]; - if (last_dim.is_static() && last_dim.get_length() == 1) { - ov::Output imag_part = default_opset::Constant::create(data.get_element_type(), {}, {0}); - imag_part = - std::make_shared(imag_part, std::make_shared(data)); - data = std::make_shared(OutputVector{data, imag_part}, last_axis_pos); - return true; - } - } - // [D_0, D_1, ..., D_{N-1}, 2] case, so additional transformations not needed or we are not able to check it during - // importing. - return false; -} -} // namespace - OutputVector dft(const Node& node) { const OutputVector ng_inputs{node.get_ng_inputs()}; - ov::Output data = ng_inputs.at(0); + const ov::Output data = ng_inputs.at(0); const auto dft_length_provided = ng_inputs.size() > 1 && !ngraph::op::is_null(ng_inputs[1]); const auto axis = node.get_attribute_value("axis", 1); - const auto axis_const = default_opset::Constant::create(element::i64, {1}, {axis}); const auto inverse = node.get_attribute_value("inverse", 0); const auto onesided = node.get_attribute_value("onesided", 0); - bool conversion_to_complex_applied = false; - if (inverse || !onesided) { // skip for RDFT case - conversion_to_complex_applied = try_convert_real_to_complex(data); - } - - ov::Output result; - if (inverse) { - if (onesided) { - result = dft_length_provided ? std::make_shared(data, axis_const, ng_inputs.at(1)) - : std::make_shared(data, axis_const); - if (conversion_to_complex_applied) { // align the output shape with a real numbers representation - const auto unsqueeze_axis = default_opset::Constant::create(element::i64, {}, {-1}); - result = std::make_shared(result, unsqueeze_axis); - } - } else { - result = dft_length_provided ? std::make_shared(data, axis_const, ng_inputs.at(1)) - : std::make_shared(data, axis_const); - } - } else { - if (onesided) { - result = dft_length_provided ? std::make_shared(data, axis_const, ng_inputs.at(1)) - : std::make_shared(data, axis_const); - } else { - result = dft_length_provided ? std::make_shared(data, axis_const, ng_inputs.at(1)) - : std::make_shared(data, axis_const); - } - } - return {result}; + return {dft::make_dft(data, + dft_length_provided ? ng_inputs.at(1) : std::make_shared(), + axis, + inverse == 1, + onesided == 1)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/stft.cpp b/src/frontends/onnx/frontend/src/op/stft.cpp new file mode 100644 index 00000000000..016aba8a9bb --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/stft.cpp @@ -0,0 +1,124 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "op/stft.hpp" + +#include "default_opset.hpp" +#include "exceptions.hpp" +#include "onnx_import/core/null_node.hpp" +#include "utils/common.hpp" +#include "utils/dft.hpp" + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_17 { + +OutputVector stft(const Node& node) { + const OutputVector ng_inputs{node.get_ng_inputs()}; + auto signal = ng_inputs.at(0); + const auto dft_length_provided = ng_inputs.size() > 3 && !ngraph::op::is_null(ng_inputs[3]); + const auto onesided = node.get_attribute_value("onesided", 1); + const int64_t axis = 1; + + const auto& frame_step_node = ng_inputs.at(1); + CHECK_VALID_NODE(node, + ngraph::op::is_constant(frame_step_node.get_node_shared_ptr()) && + ov::shape_size(frame_step_node.get_shape()) <= 1, + "frame_step input must be a scalar or Shape{1} constant."); + const auto frame_step = + ov::as_type_ptr(frame_step_node.get_node_shared_ptr())->cast_vector()[0]; + const auto signal_param_shape = signal.get_partial_shape(); + CHECK_VALID_NODE(node, + signal_param_shape.is_static() && signal_param_shape.size() == 3, + "Shape of signal input must be static with the rank equal to 3."); + + int64_t frame_length = signal_param_shape[axis].get_length() / frame_step; // default value + if (dft_length_provided) { + const auto& frame_length_node = ng_inputs[3]; + CHECK_VALID_NODE(node, + ngraph::op::is_constant(frame_length_node.get_node_shared_ptr()) && + ov::shape_size(frame_length_node.get_shape()) <= 1, + "frame_length input must be a scalar or Shape{1} constant."); + frame_length = ov::as_type_ptr(frame_length_node.get_node_shared_ptr()) + ->cast_vector()[0]; + } + + const auto window_node_provided = ng_inputs.size() > 2 && !ngraph::op::is_null(ng_inputs[2]); + if (window_node_provided) { // window input provided + if (ng_inputs[2].get_partial_shape().rank().is_static()) { + CHECK_VALID_NODE(node, + ng_inputs[2].get_partial_shape().rank().get_length() == 1, + "The rank of window input must be 1D."); + if (ng_inputs[2].get_partial_shape()[0].is_static()) { + CHECK_VALID_NODE(node, + ng_inputs[2].get_partial_shape()[0].get_length() == frame_length, + "The length of window input must be equal to frame_length."); + } + } + } + const auto is_complex = [](const ov::Output& data) { + return data.get_partial_shape().rank().is_static() && (data.get_partial_shape().cend() - 1)->is_static() && + (data.get_partial_shape().cend() - 1)->get_length() == 2; + }; + if (onesided == 1) { + CHECK_VALID_NODE(node, !is_complex(signal), "If attribute onesided==1, signal input can NOT be complex."); + } + const int64_t batch_size = signal_param_shape[0].get_length(); + const auto nstfts = static_cast((signal_param_shape[axis].get_length() - frame_length) / frame_step) + 1; + const auto axis_const = default_opset::Constant::create(element::i64, {}, {axis}); + const auto zero_const = default_opset::Constant::create(element::i64, {}, {0}); + const auto step = default_opset::Constant::create(element::i64, Shape{2}, {1, 1}); + ov::OutputVector all_signals; + for (int64_t batch = 0; batch < batch_size; ++batch) { + ov::OutputVector signals_in_batch; + for (int64_t sig_idx = 0; sig_idx < nstfts; ++sig_idx) { + const auto start = default_opset::Constant::create(element::i64, + Shape{2}, + std::vector{batch, sig_idx * frame_step}); + const auto stop = + default_opset::Constant::create(element::i64, + Shape{2}, + std::vector{batch + 1, sig_idx * frame_step + frame_length}); + const auto slice_axes = + default_opset::Constant::create(element::i64, Shape{2}, std::vector{0, axis}); + const auto slice = std::make_shared(signal, start, stop, step, slice_axes); + const ov::Output flatten_slice = std::make_shared( + slice, + is_complex(slice) ? default_opset::Constant::create(element::i64, {2}, {-1, 2}) + : (onesided ? default_opset::Constant::create(element::i64, {1}, {-1}) + : default_opset::Constant::create(element::i64, {2}, {-1, 1})), + false); + const auto dft = dft::make_dft( + window_node_provided + ? std::make_shared( + flatten_slice, + is_complex(flatten_slice) + ? std::make_shared( // align window shape with signal shape + std::make_shared( + ng_inputs[2], + default_opset::Constant::create(element::i64, {1}, {1})), + std::make_shared(flatten_slice)) + : ng_inputs[2]) + : flatten_slice, + dft_length_provided ? ng_inputs[3] : std::make_shared(), + 0, + false, + onesided == 1); + signals_in_batch.push_back(std::make_shared(dft, zero_const)); + } + all_signals.push_back( + std::make_shared(std::make_shared(signals_in_batch, 0), + zero_const)); + } + return {std::make_shared(all_signals, 0)}; +} + +} // namespace set_17 + +} // namespace op + +} // namespace onnx_import + +} // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/op/stft.hpp b/src/frontends/onnx/frontend/src/op/stft.hpp new file mode 100644 index 00000000000..c288c99419e --- /dev/null +++ b/src/frontends/onnx/frontend/src/op/stft.hpp @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "ngraph/node.hpp" +#include "onnx_import/core/node.hpp" + +namespace ngraph { +namespace onnx_import { +namespace op { +namespace set_17 { +OutputVector stft(const Node& node); + +} // namespace set_17 + +} // namespace op + +} // namespace onnx_import + +} // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/ops_bridge.cpp b/src/frontends/onnx/frontend/src/ops_bridge.cpp index 655d4efda7a..c9073f43013 100644 --- a/src/frontends/onnx/frontend/src/ops_bridge.cpp +++ b/src/frontends/onnx/frontend/src/ops_bridge.cpp @@ -161,6 +161,7 @@ #include "op/split.hpp" #include "op/sqrt.hpp" #include "op/squeeze.hpp" +#include "op/stft.hpp" #include "op/sub.hpp" #include "op/sum.hpp" #include "op/tan.hpp" @@ -479,6 +480,10 @@ OperatorsBridge::OperatorsBridge() { REGISTER_OPERATOR("SpaceToDepth", 1, space_to_depth); REGISTER_OPERATOR("Split", 1, split); REGISTER_OPERATOR("Split", 13, split); + register_operator("STFT", + VersionRange::single_version_for_all_opsets(), + op::set_17::stft, + "frame_step and frame_length inputs must be constants; signal shape must be static;"); REGISTER_OPERATOR("Sqrt", 1, sqrt); REGISTER_OPERATOR("Squeeze", 1, squeeze); REGISTER_OPERATOR("Squeeze", 13, squeeze); diff --git a/src/frontends/onnx/frontend/src/utils/dft.cpp b/src/frontends/onnx/frontend/src/utils/dft.cpp new file mode 100644 index 00000000000..d025516d15e --- /dev/null +++ b/src/frontends/onnx/frontend/src/utils/dft.cpp @@ -0,0 +1,77 @@ +// Copyright (C) 2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "dft.hpp" + +#include "default_opset.hpp" +#include "onnx_import/core/null_node.hpp" + +using namespace ngraph::onnx_import; + +namespace ngraph { +namespace onnx_import { +namespace dft { + +namespace { +// For DFT, IDFT, IRDFT cases, if real signal are provided (with shape [D_0, D_1, ..., D_{N-1}, 1]) +// it's needed to fill tensors with zero imaginary part to be aligned with Core ops requirements. +bool try_convert_real_to_complex(ov::Output& signal) { + if (signal.get_partial_shape().rank().is_static()) { + const auto length = signal.get_partial_shape().rank().get_length(); + const auto last_axis_pos = length - 1; + const auto last_dim = signal.get_partial_shape()[last_axis_pos]; + if (last_dim.is_static() && last_dim.get_length() == 1) { + ov::Output imag_part = default_opset::Constant::create(signal.get_element_type(), {}, {0}); + imag_part = + std::make_shared(imag_part, std::make_shared(signal)); + signal = std::make_shared(OutputVector{signal, imag_part}, last_axis_pos); + return true; + } + } + // [D_0, D_1, ..., D_{N-1}, 2] case, so additional transformations not needed or we are not able to check it during + // importing. + return false; +} +} // namespace + +ov::Output make_dft(const ov::Output& signal, + const ov::Output& length, + int64_t axis, + bool is_inversed, + bool is_onesided) { + auto processed_signal = signal; + const auto axis_const = default_opset::Constant::create(element::i64, {1}, {axis}); + bool conversion_to_complex_applied = false; + if (is_inversed || !is_onesided) { // skip for RDFT case + conversion_to_complex_applied = try_convert_real_to_complex(processed_signal); + } + bool dft_length_provided = !ngraph::op::is_null(length); + + ov::Output result; + if (is_inversed) { + if (is_onesided) { + result = dft_length_provided ? std::make_shared(processed_signal, axis_const, length) + : std::make_shared(processed_signal, axis_const); + if (conversion_to_complex_applied) { // align the output shape with a real numbers representation + const auto unsqueeze_axis = default_opset::Constant::create(element::i64, {}, {-1}); + result = std::make_shared(result, unsqueeze_axis); + } + } else { + result = dft_length_provided ? std::make_shared(processed_signal, axis_const, length) + : std::make_shared(processed_signal, axis_const); + } + } else { + if (is_onesided) { + result = dft_length_provided ? std::make_shared(processed_signal, axis_const, length) + : std::make_shared(processed_signal, axis_const); + } else { + result = dft_length_provided ? std::make_shared(processed_signal, axis_const, length) + : std::make_shared(processed_signal, axis_const); + } + } + return {result}; +} +} // namespace dft +} // namespace onnx_import +} // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/utils/dft.hpp b/src/frontends/onnx/frontend/src/utils/dft.hpp new file mode 100644 index 00000000000..6ab0b01580d --- /dev/null +++ b/src/frontends/onnx/frontend/src/utils/dft.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "openvino/core/node.hpp" + +namespace ngraph { +namespace onnx_import { +namespace dft { + +ov::Output make_dft(const ov::Output& signal, + const ov::Output& length, + int64_t axis, + bool is_inversed, + bool is_one_sided); +} // namespace dft +} // namespace onnx_import +} // namespace ngraph diff --git a/src/frontends/onnx/tests/CMakeLists.txt b/src/frontends/onnx/tests/CMakeLists.txt index b6fed5f851a..597bdd33a76 100644 --- a/src/frontends/onnx/tests/CMakeLists.txt +++ b/src/frontends/onnx/tests/CMakeLists.txt @@ -68,6 +68,7 @@ set(MULTI_TEST_SRC onnx_import_org_pytorch.in.cpp onnx_import_reshape.in.cpp onnx_import_rnn.in.cpp + onnx_import_signal.in.cpp onnx_import_quant.in.cpp onnx_test_utils.in.cpp onnx_import_with_editor.in.cpp) diff --git a/src/frontends/onnx/tests/models/stft_dynamic_signal_shape.prototxt b/src/frontends/onnx/tests/models/stft_dynamic_signal_shape.prototxt new file mode 100644 index 00000000000..193223dd125 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_dynamic_signal_shape.prototxt @@ -0,0 +1,99 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + output: "frame_length" + name: "frame_length_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 16 + name: "frame_length_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 1 + type: INT + } + } + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + } + dim { + dim_value: 1 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 16 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_default_length.prototxt b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_default_length.prototxt new file mode 100644 index 00000000000..8357764b45a --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_default_length.prototxt @@ -0,0 +1,85 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 4 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 0 + type: INT + } + } + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 3 + } + dim { + dim_value: 32 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 8 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_no_default_length.prototxt b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_no_default_length.prototxt new file mode 100644 index 00000000000..6ff6e7f25e4 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_given_window_no_default_length.prototxt @@ -0,0 +1,101 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 12 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + output: "frame_length" + name: "frame_length_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 10 + name: "frame_length_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 0 + type: INT + } + } + name: "g" + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + dim_value: 48 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 10 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length.prototxt b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length.prototxt new file mode 100644 index 00000000000..a8308903c9a --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length.prototxt @@ -0,0 +1,72 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 0 + type: INT + } + } + name: "g" + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + dim { + dim_value: 128 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length_2.prototxt b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length_2.prototxt new file mode 100644 index 00000000000..f6c615292ea --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_default_length_2.prototxt @@ -0,0 +1,72 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 0 + type: INT + } + } + name: "g" + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + dim_value: 64 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_no_default_length.prototxt b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_no_default_length.prototxt new file mode 100644 index 00000000000..4589ef8fd71 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_no_onesided_complex_input_no_window_no_default_length.prototxt @@ -0,0 +1,87 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + output: "frame_length" + name: "frame_length_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 24 + name: "frame_length_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 0 + type: INT + } + } + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 4 + } + dim { + dim_value: 32 + } + dim { + dim_value: 2 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_no_onesided_real_input_no_window_default_length.prototxt b/src/frontends/onnx/tests/models/stft_no_onesided_real_input_no_window_default_length.prototxt new file mode 100644 index 00000000000..74e24441fc7 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_no_onesided_real_input_no_window_default_length.prototxt @@ -0,0 +1,72 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 0 + type: INT + } + } + name: "g" + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + dim { + dim_value: 128 + } + dim { + dim_value: 1 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_non_const_frame_length.prototxt b/src/frontends/onnx/tests/models/stft_non_const_frame_length.prototxt new file mode 100644 index 00000000000..de4e8479301 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_non_const_frame_length.prototxt @@ -0,0 +1,98 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 1 + type: INT + } + } + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + dim_value: 32 + } + dim { + dim_value: 1 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 16 + } + } + } + } + } + input { + name: "frame_length" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 16 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_non_const_frame_step.prototxt b/src/frontends/onnx/tests/models/stft_non_const_frame_step.prototxt new file mode 100644 index 00000000000..9e52d2d5859 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_non_const_frame_step.prototxt @@ -0,0 +1,99 @@ +ir_version: 8 +graph { + node { + output: "frame_length" + name: "frame_length_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 16 + name: "frame_length_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 1 + type: INT + } + } + name: "g" + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + dim_value: 32 + } + dim { + dim_value: 1 + } + } + } + } + } + input { + name: "frame_step" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 16 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_onesided_complex_input.prototxt b/src/frontends/onnx/tests/models/stft_onesided_complex_input.prototxt new file mode 100644 index 00000000000..adf0584ac97 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_onesided_complex_input.prototxt @@ -0,0 +1,100 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + output: "frame_length" + name: "frame_length_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 16 + name: "frame_length_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 1 + type: INT + } + } + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + dim_value: 32 + } + dim { + dim_value: 2 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 16 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_onesided_real_input_given_window_no_default_length.prototxt b/src/frontends/onnx/tests/models/stft_onesided_real_input_given_window_no_default_length.prototxt new file mode 100644 index 00000000000..dc0e5236524 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_onesided_real_input_given_window_no_default_length.prototxt @@ -0,0 +1,100 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + output: "frame_length" + name: "frame_length_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 16 + name: "frame_length_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "window" + input: "frame_length" + output: "Y" + op_type: "STFT" + attribute { + name: "onesided" + i: 1 + type: INT + } + } + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 2 + } + dim { + dim_value: 32 + } + dim { + dim_value: 1 + } + } + } + } + } + input { + name: "window" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 16 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/models/stft_onesided_real_input_no_window_default_length.prototxt b/src/frontends/onnx/tests/models/stft_onesided_real_input_no_window_default_length.prototxt new file mode 100644 index 00000000000..d736d9b4089 --- /dev/null +++ b/src/frontends/onnx/tests/models/stft_onesided_real_input_no_window_default_length.prototxt @@ -0,0 +1,67 @@ +ir_version: 8 +graph { + node { + output: "frame_step" + name: "frame_step_const" + op_type: "Constant" + attribute { + name: "value" + t { + dims: 1 + data_type: 7 + int64_data: 8 + name: "frame_step_tensor" + } + type: TENSOR + } + } + node { + input: "signal" + input: "frame_step" + input: "" + output: "Y" + op_type: "STFT" + } + name: "g" + input { + name: "signal" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 1 + } + dim { + dim_value: 128 + } + dim { + dim_value: 1 + } + } + } + } + } + output { + name: "Y" + type { + tensor_type { + elem_type: 1 + shape { + dim { + } + dim { + } + dim { + } + dim { + } + } + } + } + } +} +opset_import { + domain: "" + version: 17 +} diff --git a/src/frontends/onnx/tests/onnx_import.in.cpp b/src/frontends/onnx/tests/onnx_import.in.cpp index b49861e1806..3a991b69a6a 100644 --- a/src/frontends/onnx/tests/onnx_import.in.cpp +++ b/src/frontends/onnx/tests/onnx_import.in.cpp @@ -6452,249 +6452,3 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_unique_3d_with_duplicates_and_axis_2) { test_case.run(); } - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft) { - auto function = onnx_import::import_onnx_model( - file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, - 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, - 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, - 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, - 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); - test_case.add_expected_output( - Shape{3, 5, 2}, - {10.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, -2.500000f, -0.812299f, - -2.500000f, -3.440955f, 35.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, - -2.500000f, -0.812299f, -2.500000f, -3.440955f, 60.000000f, 0.000000f, -2.500000f, 3.440955f, - -2.500000f, 0.812299f, -2.500000f, -0.812299f, -2.500000f, -3.440955f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_only_real) { - auto function = onnx_import::import_onnx_model( - file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_only_real.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{3, 5, 1}, - { - 0.000000f, - 1.000000f, - 2.000000f, - 3.000000f, - 4.000000f, - 5.000000f, - 6.000000f, - 7.000000f, - 8.000000f, - 9.000000f, - 10.000000f, - 11.000000f, - 12.000000f, - 13.000000f, - 14.000000f, - }); - test_case.add_expected_output( - Shape{3, 5, 2}, - {10.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, -2.500000f, -0.812299f, - -2.500000f, -3.440955f, 35.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, - -2.500000f, -0.812299f, -2.500000f, -3.440955f, 60.000000f, 0.000000f, -2.500000f, 3.440955f, - -2.500000f, 0.812299f, -2.500000f, -0.812299f, -2.500000f, -3.440955f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_onesided) { - auto function = onnx_import::import_onnx_model( - file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_onesided.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input( - Shape{2, 4}, - {0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f}); - test_case.add_expected_output(Shape{2, 3, 2}, - {6.000000f, - 0.000000f, - -2.000000f, - 2.000000f, - -2.000000f, - 0.000000f, - 22.000000f, - 0.000000f, - -2.000000f, - 2.000000f, - -2.000000f, - 0.000000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_onesided_skip_convert_to_complex) { - auto function = - onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_onesided_skip_convert_to_complex.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input( - Shape{2, 4, 1}, - {0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f}); - test_case.add_expected_output(Shape{2, 3, 1, 2}, - {6.000000f, - 0.000000f, - -2.000000f, - 2.000000f, - -2.000000f, - 0.000000f, - 22.000000f, - 0.000000f, - -2.000000f, - 2.000000f, - -2.000000f, - 0.000000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided) { - auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_lenght_provided.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, - 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, - 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, - 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, - 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); - test_case.add_expected_output( - Shape{1, 5, 2}, - {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, 3.000000f, 0.000000f, 4.000000f, 0.000000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided_onesided) { - auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_lenght_provided_onesided.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{4, 3}, - {0.000000f, - 1.000000f, - 2.000000f, - 3.000000f, - 4.000000f, - 5.000000f, - 6.000000f, - 7.000000f, - 8.000000f, - 9.000000f, - 10.000000f, - 11.000000f}); - test_case.add_expected_output(Shape{1, 3, 2}, - {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse) { - auto function = onnx_import::import_onnx_model( - file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_inverse.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, - 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, - 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, - 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, - 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); - test_case.add_expected_output( - Shape{3, 5, 2}, - {2.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, -0.500000f, 0.162460f, - -0.500000f, 0.688191f, 7.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, - -0.500000f, 0.162460f, -0.500000f, 0.688191f, 12.000000f, 0.000000f, -0.500000f, -0.688191f, - -0.500000f, -0.162460f, -0.500000f, 0.162460f, -0.500000f, 0.688191f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_only_real) { - auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_inverse_only_real.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{3, 5, 1}, - {0.000000f, - 1.000000f, - 2.000000f, - 3.000000f, - 4.000000f, - 5.000000f, - 6.000000f, - 7.000000f, - 8.000000f, - 9.000000f, - 10.000000f, - 11.000000f, - 12.000000f, - 13.000000f, - 14.000000f}); - test_case.add_expected_output( - Shape{3, 5, 2}, - {2.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, -0.500000f, 0.162460f, - -0.500000f, 0.688191f, 7.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, - -0.500000f, 0.162460f, -0.500000f, 0.688191f, 12.000000f, 0.000000f, -0.500000f, -0.688191f, - -0.500000f, -0.162460f, -0.500000f, 0.162460f, -0.500000f, 0.688191f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided) { - auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_inverse_onesided.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{2, 3, 2}, - {6.000000f, - 0.000000f, - -2.000000f, - 2.000000f, - -2.000000f, - 0.000000f, - 22.000000f, - 0.000000f, - -2.000000f, - 2.000000f, - -2.000000f, - 0.000000f}); - test_case.add_expected_output( - Shape{2, 4}, - {0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided_real_input) { - auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_inverse_onesided_real_input.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{2, 3, 1}, {1.000000f, 0.000000f, -1.000000f, 0.5000000f, -0.5000000f, 0.000000f}); - test_case.add_expected_output(Shape{2, 3, 1}, - {0.750000f, -0.250000f, -0.500000f, 0.250000f, 0.250000f, -0.500000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) { - auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_inversed_lenght_provided.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, - 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, - 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, - 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, - 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); - test_case.add_expected_output( - Shape{1, 5, 2}, - {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, 3.000000f, 0.000000f, 4.000000f, 0.000000f}); -} - -NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided_onesided) { - auto function = - onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), - SERIALIZED_ZOO, - "onnx/dft_inverse_lenght_provided_onesided.onnx")); - auto test_case = test::TestCase(function, s_device); - test_case.add_input(Shape{1, 3, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f}); - test_case.add_expected_output(Shape{4, 3}, - {0.000000f, - 1.000000f, - 2.000000f, - 3.000000f, - 4.000000f, - 5.000000f, - 6.000000f, - 7.000000f, - 8.000000f, - 9.000000f, - 10.000000f, - 11.000000f}); -} diff --git a/src/frontends/onnx/tests/onnx_import_signal.in.cpp b/src/frontends/onnx/tests/onnx_import_signal.in.cpp new file mode 100644 index 00000000000..af186a83f80 --- /dev/null +++ b/src/frontends/onnx/tests/onnx_import_signal.in.cpp @@ -0,0 +1,1578 @@ +// Copyright (C) 2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +// clang-format off +#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS +#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS +#endif +#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS +#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS +#endif +// clang-format on + +#include "common_test_utils/file_utils.hpp" +#include "default_opset.hpp" +#include "engines_util/test_case.hpp" +#include "engines_util/test_engines.hpp" +#include "onnx_import/onnx.hpp" +#include "util/test_control.hpp" + +NGRAPH_SUPPRESS_DEPRECATED_START + +using namespace ngraph; + +static std::string s_manifest = "${MANIFEST}"; +static std::string s_device = test::backend_name_to_device("${BACKEND_NAME}"); + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, + 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, + 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, + 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, + 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); + test_case.add_expected_output( + Shape{3, 5, 2}, + {10.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, -2.500000f, -0.812299f, + -2.500000f, -3.440955f, 35.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, + -2.500000f, -0.812299f, -2.500000f, -3.440955f, 60.000000f, 0.000000f, -2.500000f, 3.440955f, + -2.500000f, 0.812299f, -2.500000f, -0.812299f, -2.500000f, -3.440955f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_only_real) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_only_real.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{3, 5, 1}, + { + 0.000000f, + 1.000000f, + 2.000000f, + 3.000000f, + 4.000000f, + 5.000000f, + 6.000000f, + 7.000000f, + 8.000000f, + 9.000000f, + 10.000000f, + 11.000000f, + 12.000000f, + 13.000000f, + 14.000000f, + }); + test_case.add_expected_output( + Shape{3, 5, 2}, + {10.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, -2.500000f, -0.812299f, + -2.500000f, -3.440955f, 35.000000f, 0.000000f, -2.500000f, 3.440955f, -2.500000f, 0.812299f, + -2.500000f, -0.812299f, -2.500000f, -3.440955f, 60.000000f, 0.000000f, -2.500000f, 3.440955f, + -2.500000f, 0.812299f, -2.500000f, -0.812299f, -2.500000f, -3.440955f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_onesided) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_onesided.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input( + Shape{2, 4}, + {0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f}); + test_case.add_expected_output(Shape{2, 3, 2}, + {6.000000f, + 0.000000f, + -2.000000f, + 2.000000f, + -2.000000f, + 0.000000f, + 22.000000f, + 0.000000f, + -2.000000f, + 2.000000f, + -2.000000f, + 0.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_onesided_skip_convert_to_complex) { + auto function = + onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_onesided_skip_convert_to_complex.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input( + Shape{2, 4, 1}, + {0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f}); + test_case.add_expected_output(Shape{2, 3, 1, 2}, + {6.000000f, + 0.000000f, + -2.000000f, + 2.000000f, + -2.000000f, + 0.000000f, + 22.000000f, + 0.000000f, + -2.000000f, + 2.000000f, + -2.000000f, + 0.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided) { + auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_lenght_provided.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, + 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, + 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, + 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, + 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); + test_case.add_expected_output( + Shape{1, 5, 2}, + {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, 3.000000f, 0.000000f, 4.000000f, 0.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided_onesided) { + auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_lenght_provided_onesided.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{4, 3}, + {0.000000f, + 1.000000f, + 2.000000f, + 3.000000f, + 4.000000f, + 5.000000f, + 6.000000f, + 7.000000f, + 8.000000f, + 9.000000f, + 10.000000f, + 11.000000f}); + test_case.add_expected_output(Shape{1, 3, 2}, + {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_inverse.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, + 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, + 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, + 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, + 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); + test_case.add_expected_output( + Shape{3, 5, 2}, + {2.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, -0.500000f, 0.162460f, + -0.500000f, 0.688191f, 7.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, + -0.500000f, 0.162460f, -0.500000f, 0.688191f, 12.000000f, 0.000000f, -0.500000f, -0.688191f, + -0.500000f, -0.162460f, -0.500000f, 0.162460f, -0.500000f, 0.688191f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_only_real) { + auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_inverse_only_real.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{3, 5, 1}, + {0.000000f, + 1.000000f, + 2.000000f, + 3.000000f, + 4.000000f, + 5.000000f, + 6.000000f, + 7.000000f, + 8.000000f, + 9.000000f, + 10.000000f, + 11.000000f, + 12.000000f, + 13.000000f, + 14.000000f}); + test_case.add_expected_output( + Shape{3, 5, 2}, + {2.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, -0.500000f, 0.162460f, + -0.500000f, 0.688191f, 7.000000f, 0.000000f, -0.500000f, -0.688191f, -0.500000f, -0.162460f, + -0.500000f, 0.162460f, -0.500000f, 0.688191f, 12.000000f, 0.000000f, -0.500000f, -0.688191f, + -0.500000f, -0.162460f, -0.500000f, 0.162460f, -0.500000f, 0.688191f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided) { + auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_inverse_onesided.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{2, 3, 2}, + {6.000000f, + 0.000000f, + -2.000000f, + 2.000000f, + -2.000000f, + 0.000000f, + 22.000000f, + 0.000000f, + -2.000000f, + 2.000000f, + -2.000000f, + 0.000000f}); + test_case.add_expected_output( + Shape{2, 4}, + {0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided_real_input) { + auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_inverse_onesided_real_input.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{2, 3, 1}, {1.000000f, 0.000000f, -1.000000f, 0.5000000f, -0.5000000f, 0.000000f}); + test_case.add_expected_output(Shape{2, 3, 1}, + {0.750000f, -0.250000f, -0.500000f, 0.250000f, 0.250000f, -0.500000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) { + auto function = onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_inversed_lenght_provided.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, + 3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f, + 6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f, + 9.000000f, 0.000000f, 10.000000f, 0.000000f, 11.000000f, 0.000000f, + 12.000000f, 0.000000f, 13.000000f, 0.000000f, 14.000000f, 0.000000f}); + test_case.add_expected_output( + Shape{1, 5, 2}, + {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f, 3.000000f, 0.000000f, 4.000000f, 0.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided_onesided) { + auto function = + onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/dft_inverse_lenght_provided_onesided.onnx")); + auto test_case = test::TestCase(function, s_device); + test_case.add_input(Shape{1, 3, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f}); + test_case.add_expected_output(Shape{4, 3}, + {0.000000f, + 1.000000f, + 2.000000f, + 3.000000f, + 4.000000f, + 5.000000f, + 6.000000f, + 7.000000f, + 8.000000f, + 9.000000f, + 10.000000f, + 11.000000f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_onesided_real_input_no_window_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_onesided_real_input_no_window_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{1, 128, 1}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_expected_output( + Shape{1, 15, 9, 2}, + {120.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, + -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, 248.0f, 0.0f, + -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, + -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, 376.0f, 0.0f, -8.0f, 40.218716f, + -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, + -8.0f, 1.5912971f, -8.0f, 0.0f, 504.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, + -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, + -8.0f, 0.0f, 632.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, + -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, + 760.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, + -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, 888.0f, 0.0f, + -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, + -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, 1016.0f, 0.0f, -8.0f, 40.218716f, + -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, + -8.0f, 1.5912971f, -8.0f, 0.0f, 1144.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, + -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, + -8.0f, 0.0f, 1272.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, + -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, + 1400.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, + -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, 1528.0f, 0.0f, + -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, + -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, 1656.0f, 0.0f, -8.0f, 40.218716f, + -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, + -8.0f, 1.5912971f, -8.0f, 0.0f, 1784.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, + -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, + -8.0f, 0.0f, 1912.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, + -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_real_input_no_window_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_no_onesided_real_input_no_window_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{1, 128, 1}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_expected_output( + Shape{1, 15, 16, 2}, + {120.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, + -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, + -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, + -8.0f, -40.218716f, 248.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, + -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, + -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, + -8.0f, -19.31371f, -8.0f, -40.218716f, 376.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, + -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, + -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, + -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, 504.0f, 0.0f, -8.0f, 40.218716f, + -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, + -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, + -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, 632.0f, 0.0f, + -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, + -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, + -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, + 760.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, + -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, + -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, + -8.0f, -40.218716f, 888.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, + -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, + -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, + -8.0f, -19.31371f, -8.0f, -40.218716f, 1016.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, + -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, + -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, + -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, 1144.0f, 0.0f, -8.0f, 40.218716f, + -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, + -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, + -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, 1272.0f, 0.0f, + -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, + -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, + -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, + 1400.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, + -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, + -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, + -8.0f, -40.218716f, 1528.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, + -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, + -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, + -8.0f, -19.31371f, -8.0f, -40.218716f, 1656.0f, 0.0f, -8.0f, 40.218716f, -8.0f, 19.31371f, + -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, -8.0f, 1.5912971f, + -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, -8.0f, -8.0f, + -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, 1784.0f, 0.0f, -8.0f, 40.218716f, + -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, -8.0f, 3.3137083f, + -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, -8.0f, -5.3454294f, + -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f, 1912.0f, 0.0f, + -8.0f, 40.218716f, -8.0f, 19.31371f, -8.0f, 11.972846f, -8.0f, 8.0f, -8.0f, 5.3454294f, + -8.0f, 3.3137083f, -8.0f, 1.5912971f, -8.0f, 0.0f, -8.0f, -1.5912971f, -8.0f, -3.3137083f, + -8.0f, -5.3454294f, -8.0f, -8.0f, -8.0f, -11.972846f, -8.0f, -19.31371f, -8.0f, -40.218716f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_window_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_no_onesided_complex_input_no_window_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{1, 128, 2}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_expected_output(Shape{1, 15, 16, 2}, + {240.0f, + 256.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 496.0f, + 512.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 752.0f, + 768.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 1008.0f, + 1024.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 1264.0f, + 1280.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 1520.0f, + 1536.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 1776.0f, + 1792.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 2032.0f, + 2048.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 2288.0f, + 2304.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 2544.0f, + 2560.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 2800.0f, + 2816.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 3056.0f, + 3072.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 3312.0f, + 3328.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 3568.0f, + 3584.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f, + 3824.0f, + 3840.0f, + -96.43743187401357f, + 64.43743187401357f, + -54.62741699796952f, + 22.627416997969522f, + -39.94569220264782f, + 7.945692202647823f, + -32.0f, + 0.0f, + -26.69085820670878f, + -5.3091417932912215f, + -22.627416997969522f, + -9.372583002030478f, + -19.182597878074528f, + -12.817402121925468f, + -16.0f, + -16.0f, + -12.817402121925468f, + -19.182597878074528f, + -9.372583002030478f, + -22.627416997969522f, + -5.3091417932912215f, + -26.69085820670878f, + 0.0f, + -32.0f, + 7.945692202647823f, + -39.94569220264782f, + 22.627416997969522f, + -54.62741699796952f, + 64.43743187401357f, + -96.43743187401357f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_window_default_length_2) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_no_onesided_complex_input_no_window_default_length_2.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{2, 64, 2}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_expected_output(Shape{2, 8, 8, 2}, + {56.0f, 64.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 184.0f, 192.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 312.0f, 320.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 440.0f, 448.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 568.0f, 576.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 696.0f, 704.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 824.0f, 832.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 952.0f, 960.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1080.0f, 1088.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1208.0f, 1216.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1336.0f, 1344.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1464.0f, 1472.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1592.0f, 1600.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1720.0f, 1728.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1848.0f, 1856.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f, -27.31370849898476f, + 1976.0f, 1984.0f, -27.31370849898476f, 11.313708498984761f, + -16.0f, 0.0f, -11.313708498984761f, -4.686291501015239f, + -8.0f, -8.0f, -4.686291501015239f, -11.313708498984761f, + 0.0f, -16.0f, 11.313708498984761f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_window_no_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_no_onesided_complex_input_no_window_no_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{4, 32, 2}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_expected_output(Shape{4, 2, 24, 2}, + {552.0f, + 576.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 936.0f, + 960.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 2088.0f, + 2112.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 2472.0f, + 2496.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 3624.0f, + 3648.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 4008.0f, + 4032.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 5160.0f, + 5184.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f, + 5544.0f, + 5568.0f, + -206.29809870540362f, + 158.29809870540362f, + -113.56921938165306f, + 65.56921938165306f, + -81.94112549695429f, + 33.941125496954285f, + -65.56921938165306f, + 17.569219381653056f, + -55.277408948188935f, + 7.277408948188935f, + -48.0f, + 0.0f, + -42.41584771149505f, + -5.584152288504953f, + -37.856406460551014f, + -10.143593539448982f, + -33.941125496954285f, + -14.058874503045715f, + -30.430780618346944f, + -17.569219381653056f, + -27.159659942097512f, + -20.840340057902488f, + -24.0f, + -24.0f, + -20.840340057902495f, + -27.159659942097505f, + -17.569219381653056f, + -30.430780618346944f, + -14.058874503045715f, + -33.941125496954285f, + -10.143593539448982f, + -37.856406460551014f, + -5.584152288504953f, + -42.41584771149505f, + 0.0f, + -48.0f, + 7.277408948188942f, + -55.27740894818894f, + 17.569219381653056f, + -65.56921938165306f, + 33.941125496954285f, + -81.94112549695429f, + 65.56921938165306f, + -113.56921938165306f, + 158.29809870540362f, + -206.29809870540362f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_given_window_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_no_onesided_complex_input_given_window_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{3, 32, 2}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_input(Shape{8}, + {1.0f, 0.8535616f, 0.5000232f, 0.1464712f, 0.0f, 0.1464057f, 0.49993038f, 0.853496f}); + test_case.add_expected_output( + Shape{3, 7, 8, 2}, + {23.9982088804245f, 27.99809694290161f, -3.6551388463010377f, 21.654558190325933f, -17.655848562717438f, + 1.6573804020881653f, -11.656437880922656f, -4.342796101262486f, -7.999694228172302f, -7.999675154685974f, + -4.342819217778247f, -11.656414517382817f, 1.6573339104652405f, -17.655802190303802f, 19.65439594500194f, + -1.6553475716806292f, 55.997313380241394f, 59.997201442718506f, 12.346159116290885f, 37.6528883872892f, + -17.65547662973404f, 1.6577513813972473f, -11.65625294879657f, -4.342609192943764f, -7.999541640281677f, + -7.999522566795349f, -4.342632309459525f, -11.656229585256732f, 1.6577048897743225f, -17.655430257320404f, + 35.65272614196521f, 14.345950390911293f, 87.99641788005829f, 91.9963059425354f, 28.347457078882808f, + 53.651218584252476f, -17.65510469675064f, 1.6581223607063293f, -11.656068016670485f, -4.342422284625041f, + -7.999389052391052f, -7.999369978904724f, -4.342445401140804f, -11.65604465313065f, 1.6580758690834045f, + -17.655058324337006f, 51.651056338928484f, 30.347248353503215f, 119.99552237987518f, 123.9954104423523f, + 44.34875504147473f, 69.64954878121574f, -17.654732763767242f, 1.6584933400154114f, -11.6558830845444f, + -4.34223537630632f, -7.999236464500427f, -7.999217391014099f, -4.342258492822079f, -11.65585972100456f, + 1.6584468483924866f, -17.654686391353607f, 67.64938653589175f, 46.34854631609514f, 151.99462687969208f, + 155.9945149421692f, 60.35005300406665f, 85.64787897817901f, -17.654360830783844f, 1.6588643193244934f, + -11.65569815241831f, -4.3420484679875955f, -7.999083876609802f, -7.999064803123474f, -4.342071584503358f, + -11.655674788878471f, 1.6588178277015686f, -17.65431445837021f, 83.64771673285502f, 62.34984427868706f, + 183.99373137950897f, 187.99361944198608f, 76.35135096665857f, 101.64620917514227f, -17.653988897800446f, + 1.6592352986335754f, -11.655513220292228f, -4.341861559668871f, -7.998931288719177f, -7.998912215232849f, + -4.341884676184634f, -11.65548985675239f, 1.6591888070106506f, -17.65394252538681f, 99.64604692981828f, + 78.35114224127898f, 215.99283587932587f, 219.99272394180298f, 92.3526489292505f, 117.64453937210556f, + -17.653616964817047f, 1.6596062779426575f, -11.655328288166146f, -4.341674651350154f, -7.998778700828552f, + -7.998759627342224f, -4.3416977678659165f, -11.655304924626307f, 1.6595597863197327f, -17.653570592403412f, + 115.64437712678156f, 94.35244020387091f, 279.99104487895966f, 283.99093294143677f, 124.35524485443435f, + 149.6411997660321f, -17.65287309885025f, 1.6603482365608215f, -11.654958423913968f, -4.341300834712712f, + -7.998473525047302f, -7.998454451560974f, -4.341323951228475f, -11.654935060374129f, 1.6603017449378967f, + -17.652826726436615f, 147.6410375207081f, 126.35503612905475f, 311.99014937877655f, 315.99003744125366f, + 140.35654281702625f, 165.63952996299537f, -17.652501165866852f, 1.6607192158699036f, -11.654773491787878f, + -4.341113926393987f, -7.998320937156677f, -7.998301863670349f, -4.34113704290975f, -11.65475012824804f, + 1.6606727242469788f, -17.652454793453217f, 163.63936771767135f, 142.35633409164666f, 343.98925387859344f, + 347.98914194107056f, 156.3578407796182f, 181.63786015995862f, -17.652129232883453f, 1.6610901951789856f, + -11.654588559661818f, -4.340927018075263f, -7.998168349266052f, -7.998149275779724f, -4.340950134591026f, + -11.654565196121965f, 1.6610437035560608f, -17.652082860469818f, 179.63769791463466f, 158.3576320542386f, + 375.98835837841034f, 379.98824644088745f, 172.35913874221012f, 197.63619035692193f, -17.651757299900055f, + 1.6614611744880676f, -11.654403627535729f, -4.340740109756538f, -7.998015761375427f, -7.997996687889099f, + -4.340763226272301f, -11.65438026399589f, 1.6614146828651428f, -17.65171092748642f, 195.6360281115979f, + 174.35893001683053f, 407.98746287822723f, 411.98735094070435f, 188.36043670480203f, 213.63452055388518f, + -17.651385366916656f, 1.6618321537971497f, -11.65421869540964f, -4.340553201437814f, -7.997863173484802f, + -7.997844099998474f, -4.340576317953577f, -11.6541953318698f, 1.6617856621742249f, -17.65133899450302f, + 211.6343583085612f, 190.36022797942243f, 439.9865673780441f, 443.98645544052124f, 204.36173466739393f, + 229.63285075084843f, -17.651013433933258f, 1.6622031331062317f, -11.65403376328355f, -4.340366293119089f, + -7.997710585594177f, -7.997691512107849f, -4.340389409634852f, -11.654010399743711f, 1.6621566414833069f, + -17.650967061519623f, 227.63268850552447f, 206.36152594201434f, 471.985671877861f, 475.98555994033813f, + 220.36303262998587f, 245.6311809478117f, -17.65064150094986f, 1.6625741124153137f, -11.653848831157461f, + -4.340179384800379f, -7.997557997703552f, -7.997538924217224f, -4.340202501316128f, -11.653825467617622f, + 1.662527620792389f, -17.650595128536224f, 243.63101870248772f, 222.36282390460627f, 535.9838808774948f, + 539.9837689399719f, 252.3656285551697f, 277.62784134173825f, -17.649897634983063f, 1.6633160710334778f, + -11.653478966905283f, -4.339805568162916f, -7.997252821922302f, -7.997233748435974f, -4.339828684678679f, + -11.653455603365444f, 1.663269579410553f, -17.649851262569427f, 275.6276790964142f, 254.3654198297901f, + 567.9829853773117f, 571.9828734397888f, 268.3669265177616f, 293.62617153870156f, -17.649525701999664f, + 1.6636870503425598f, -11.653294034779236f, -4.339618659844206f, -7.997100234031677f, -7.997081160545349f, + -4.339641776359969f, -11.653270671239369f, 1.663640558719635f, -17.64947932958603f, 291.6260092933776f, + 270.366717792382f, 599.9820898771286f, 603.9819779396057f, 284.36822448035355f, 309.6245017356648f, + -17.649153769016266f, 1.6640580296516418f, -11.653109102653133f, -4.339431751525495f, -7.996947646141052f, + -7.996928572654724f, -4.33945486804123f, -11.653085739113294f, 1.664011538028717f, -17.64910739660263f, + 307.62433949034084f, 286.36801575497395f, 631.9811943769455f, 635.9810824394226f, 300.3695224429455f, + 325.62283193262806f, -17.648781836032867f, 1.6644290089607239f, -11.652924170527058f, -4.339244843206757f, + -7.996795058250427f, -7.996775984764099f, -4.33926795972252f, -11.65290080698719f, 1.664382517337799f, + -17.648735463619232f, 323.6226696873041f, 302.3693137175659f, 663.9802988767624f, 667.9801869392395f, + 316.3708204055374f, 341.6211621295913f, -17.64840990304947f, 1.664799988269806f, -11.652739238400954f, + -4.3390579348880465f, -7.996642470359802f, -7.996623396873474f, -4.339081051403809f, -11.652715874861116f, + 1.664753496646881f, -17.648363530635834f, 339.62099988426735f, 318.3706116801578f, 695.9794033765793f, + 699.9792914390564f, 332.37211836812935f, 357.61949232655456f, -17.64803797006607f, 1.665170967578888f, + -11.65255430627488f, -4.338871026569308f, -7.996489882469177f, -7.996470808982849f, -4.338894143085071f, + -11.652530942735012f, 1.6651244759559631f, -17.647991597652435f, 355.6193300812306f, 334.37190964274976f, + 727.9785078763962f, 731.9783959388733f, 348.3734163307213f, 373.6178225235179f, -17.647666037082672f, + 1.66554194688797f, -11.652369374148776f, -4.3386841182505975f, -7.996337294578552f, -7.996318221092224f, + -4.33870723476636f, -11.652346010608937f, 1.6654954552650452f, -17.647619664669037f, 371.61766027819385f, + 350.3732076053417f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_given_window_no_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_no_onesided_complex_input_given_window_no_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{2, 48, 2}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_input(Shape{10}, + {1.0f, + 0.90451396f, + 0.6545261f, + 0.345518f, + 0.095513284f, + 0.0f, + 0.095458746f, + 0.34542978f, + 0.654438f, + 0.9044596f}); + test_case.add_expected_output( + Shape{2, 4, 10, 2}, + {39.99714946746826f, 44.997006952762604f, -3.8268060472046876f, 36.32573598813075f, -26.390974611367387f, + 6.3932079238754085f, -17.885399480520576f, -2.113604756384621f, -13.440595214714953f, -6.558716539769538f, + -9.999701499938965f, -9.999686658382416f, -6.558733350911233f, -13.440578420114413f, -2.1136289848897007f, + -17.88537512225368f, 6.393153709525318f, -26.390919916754058f, 33.82553601255393f, -1.327069451110034f, + 159.99372911453247f, 164.9935865998268f, 56.17799336663901f, 96.31941429440245f, -26.389673466965206f, + 6.3945205945953365f, -17.884817996398652f, -2.113020157979113f, -13.440191747314223f, -6.558313469356559f, + -9.999345302581787f, -9.999330461025238f, -6.558330280498261f, -13.440174952713676f, -2.113044386484189f, + -17.88479363813176f, 6.394466380245246f, -26.38961877235188f, 93.81921431882563f, 58.677729962733665f, + 279.9903087615967f, 284.990166246891f, 116.1827927804827f, 156.31309260067414f, -26.38837232256303f, + 6.395833265315265f, -17.88423651227673f, -2.1124355595736013f, -13.4397882799135f, -6.557910398943584f, + -9.99898910522461f, -9.99897426366806f, -6.557927210085282f, -13.439771485312946f, -2.112459788078681f, + -17.88421215400984f, 6.3957790509651735f, -26.3883176279497f, 153.81289262509733f, 118.68252937657735f, + 399.9868884086609f, 404.98674589395523f, 176.18759219432638f, 216.30677090694581f, -26.38707117816086f, + 6.397145936035198f, -17.88365502815482f, -2.1118509611680913f, -13.43938481251277f, -6.557507328530605f, + -9.998632907867432f, -9.998618066310883f, -6.557524139672296f, -13.43936801791223f, -2.1118751896731798f, + -17.883630669887918f, 6.397091721685095f, -26.387016483547516f, 213.806570931369f, 178.68732879042108f, + 519.9834680557251f, 524.9833255410194f, 236.19239160817006f, 276.3004492132175f, -26.385770033758675f, + 6.398458606755116f, -17.8830735440329f, -2.1112663627625903f, -13.43898134511204f, -6.5571042581176044f, + -9.998276710510254f, -9.998261868953705f, -6.55712106925931f, -13.438964550511457f, -2.1112905912676663f, + -17.883049185766005f, 6.398404392405028f, -26.385715339145342f, 273.8002492376407f, 238.69212820426475f, + 639.9800477027893f, 644.9799051880836f, 296.1971910220138f, 336.2941275194893f, -26.384468889356498f, + 6.399771277475056f, -17.882492059910966f, -2.1106817643570555f, -13.438577877711282f, -6.556701187704647f, + -9.997920513153076f, -9.997905671596527f, -6.556717998846352f, -13.438561083110784f, -2.1107059928621457f, + -17.88246770164406f, 6.399717063124951f, -26.384414194743158f, 333.7939275439124f, 298.6969276181085f, + 759.9766273498535f, 764.9764848351479f, 356.2019904358574f, 396.28780582576087f, -26.38316774495431f, + 6.401083948194983f, -17.88191057578905f, -2.1100971659515597f, -13.438174410310552f, -6.556298117291675f, + -9.997564315795898f, -9.99754947423935f, -6.556314928433352f, -13.438157615710026f, -2.1101213944566375f, + -17.88188621752216f, 6.401029733844893f, -26.38311305034098f, 393.78760585018404f, 358.70172703195215f, + 879.9732069969177f, 884.9730644822121f, 416.2067898497012f, 456.2814841320326f, -26.38186660055215f, + 6.402396618914892f, -17.881329091667133f, -2.109512567546055f, -13.437770942909793f, -6.555895046878646f, + -9.99720811843872f, -9.997193276882172f, -6.55591185802038f, -13.437754148309267f, -2.1095367960511293f, + -17.881304733400242f, 6.402342404564804f, -26.381811905938818f, 453.78128415645574f, 418.7065264457958f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_onesided_real_input_given_window_no_default_length) { + auto function = onnx_import::import_onnx_model( + file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_onesided_real_input_given_window_no_default_length.onnx")); + auto test_case = test::TestCase(function, s_device); + const Shape signal_shape{2, 32, 1}; + std::vector signal(ov::shape_size(signal_shape)); + std::iota(std::begin(signal), std::end(signal), 0.f); + test_case.add_input(signal_shape, signal); + test_case.add_input(Shape{16}, + {1.0f, + 0.96194196f, + 0.8535616f, + 0.6913578f, + 0.5000232f, + 0.308685f, + 0.1464712f, + 0.038075745f, + 0.0f, + 0.03804031f, + 0.1464057f, + 0.3085994f, + 0.49993038f, + 0.6912722f, + 0.853496f, + 0.96190655f}); + test_case.add_expected_output( + Shape{2, 3, 9, 2}, + {55.996273f, 0.0f, 23.999104f, 24.93398f, -7.99869f, 22.70421f, -7.999475f, 12.814739f, + -7.999694f, 8.329526f, -7.999781f, 5.5011215f, -7.999824f, 3.3910275f, -7.9998474f, 1.6240749f, + -7.999859f, 0.0f, 119.99441f, 0.0f, 55.998657f, 24.931015f, -7.9980354f, 22.704208f, + -7.9992137f, 12.814741f, -7.999542f, 8.329527f, -7.9996705f, 5.5011196f, -7.999737f, 3.3910284f, + -7.999769f, 1.6240768f, -7.9997787f, 0.0f, 183.99254f, 0.0f, 87.998215f, 24.928047f, + -7.9973803f, 22.70421f, -7.9989514f, 12.814744f, -7.9993896f, 8.329525f, -7.999561f, 5.5011206f, + -7.999648f, 3.3910275f, -7.9996986f, 1.6240759f, -7.99971f, 0.0f, 311.98883f, 0.0f, + 151.99731f, 24.922113f, -7.9960704f, 22.704214f, -7.998431f, 12.814743f, -7.9990845f, 8.329521f, + -7.999341f, 5.5011144f, -7.999474f, 3.3910275f, -7.999542f, 1.6240788f, -7.9995728f, 0.0f, + 375.98694f, 0.0f, 183.99686f, 24.919151f, -7.9954133f, 22.704203f, -7.9981623f, 12.814751f, + -7.998932f, 8.329529f, -7.9992285f, 5.501122f, -7.9993834f, 3.3910313f, -7.9994736f, 1.6240854f, + -7.9994965f, 0.0f, 439.98508f, 0.0f, 215.9964f, 24.916183f, -7.99476f, 22.704206f, + -7.9979024f, 12.814749f, -7.9987793f, 8.329529f, -7.999122f, 5.5011153f, -7.9992967f, 3.391035f, + -7.999382f, 1.6240807f, -7.99942f, 0.0f}); +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_non_const_frame_step) { + try { + onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_non_const_frame_step.onnx")); + FAIL() << "Unknown error during STFT import"; + } catch (const std::runtime_error& exc) { + std::string msg{exc.what()}; + EXPECT_TRUE(msg.find("frame_step input must be a scalar or Shape{1} constant.") != std::string::npos); + } +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_dynamic_singal_shape) { + try { + onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_dynamic_signal_shape.onnx")); + FAIL() << "Unknown error during STFT import"; + } catch (const std::runtime_error& exc) { + std::string msg{exc.what()}; + EXPECT_TRUE(msg.find("Shape of signal input must be static with the rank equal to 3.") != std::string::npos); + } +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_non_const_frame_length) { + try { + onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_non_const_frame_length.onnx")); + FAIL() << "Unknown error during STFT import"; + } catch (const std::runtime_error& exc) { + std::string msg{exc.what()}; + EXPECT_TRUE(msg.find("frame_length input must be a scalar or Shape{1} constant.") != std::string::npos); + } +} + +NGRAPH_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_complex_signal_and_onesided) { + try { + onnx_import::import_onnx_model(file_util::path_join(CommonTestUtils::getExecutableDirectory(), + SERIALIZED_ZOO, + "onnx/stft_onesided_complex_input.onnx")); + FAIL() << "Unknown error during STFT import"; + } catch (const std::runtime_error& exc) { + std::string msg{exc.what()}; + EXPECT_TRUE(msg.find("If attribute onesided==1, signal input can NOT be complex.") != std::string::npos); + } +}