OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[ISTFT][CPU] Add ISTFT op to CPU and enable by ref (#28857)
Katarzyna Mitrusda00e90afb7e
diff --git a/src/core/reference/src/op/istft.cpp b/src/core/reference/src/op/istft.cppindex b01b5ee1896..254c7216396 100644--- a/src/core/reference/src/op/istft.cpp+++ b/src/core/reference/src/op/istft.cpp@@ -39,10 +39,13 @@ void istft(const float* in_data,std::vector<float> mid_result(batch_size * signal_length, 0.f);float* result = mid_result.data();+ const auto fft_results_dim = data_shape[data_shape.size() - 3];+ OPENVINO_ASSERT(fft_results_dim == static_cast<size_t>((frame_size / 2) + 1));+const auto frame_size_dim = static_cast<size_t>(frame_size);const auto frame_size_dim_shape = Shape{frame_size_dim};const auto frame_size_dim_shape_out = Shape{frame_size_dim, 2};- const auto fft_out_shape = Shape{static_cast<size_t>((frame_size_dim / 2) + 1), 2};+ const auto fft_out_shape = Shape{fft_results_dim, 2};const auto window_length = window_shape[0] < frame_size_dim ? window_shape[0] : frame_size_dim;std::vector<float> pad_window(frame_size, 0);@@ -116,14 +119,14 @@ void istft(const float* in_data,func::add<float>);}- std::transform(result, result + signal_length, window_sum.begin(), result, postprocess_func);+ std::transform(result, result + signal_length, window_sum.begin() + batch_out_start, result, postprocess_func);const auto result_start = result + margin;std::copy(result_start, result_start + copy_end, final_result);batch_in_start += in_batch_single_step;batch_out_start += signal_length;- result += batch_out_start;+ result += signal_length;final_result += final_signal_length;}}diff --git a/src/core/shape_inference/include/istft_shape_inference.hpp b/src/core/shape_inference/include/istft_shape_inference.hppindex d013c8e305c..39a3c3cff9b 100644--- a/src/core/shape_inference/include/istft_shape_inference.hpp+++ b/src/core/shape_inference/include/istft_shape_inference.hpp@@ -63,6 +63,15 @@ std::vector<TRShape> shape_infer(const ISTFT* op,"Window input dimension must be in range [1, ",frame_size_val,"].");++ if (data_shape.is_static()) {+ const auto& in_fft_dim = data_shape[data_shape.size() - 3];+ const auto expected_fft_dim = TDim(frame_size_val / 2 + 1);+ NODE_SHAPE_INFER_CHECK(op,+ input_shapes,+ in_fft_dim.compatible(expected_fft_dim),+ "The dimension at data_shape[-3] must be equal to: (frame_size // 2 + 1) ");+ }}if (frame_step) {diff --git a/src/core/tests/type_prop/istft.cpp b/src/core/tests/type_prop/istft.cppindex a643e472e2c..6516aef42ba 100644--- a/src/core/tests/type_prop/istft.cpp+++ b/src/core/tests/type_prop/istft.cpp@@ -401,9 +401,9 @@ TEST_F(TypePropISTFTTest, frame_step_incompatible_type) {}TEST_F(TypePropISTFTTest, frame_step_incompatible_value) {- const auto signal = std::make_shared<Parameter>(element::f32, PartialShape{9, 9, 2});+ const auto signal = std::make_shared<Parameter>(element::f32, PartialShape{9, 3, 2});const auto window = std::make_shared<Parameter>(element::f32, PartialShape{8});- const auto frame_size = Constant::create<int32_t>(element::i32, {}, {8});+ const auto frame_size = Constant::create<int32_t>(element::i32, {}, {16});{const auto frame_step = Constant::create<int32_t>(element::i32, {}, {-1});OV_EXPECT_THROW(std::ignore = make_op(signal, window, frame_size, frame_step, center, normalized),@@ -435,4 +435,14 @@ TEST_F(TypePropISTFTTest, window_incompatible_dim_with_frame_size) {HasSubstr("Window input dimension must be in range [1, 8]"));}+TEST_F(TypePropISTFTTest, data_shape_incompatible_dim_with_frame_size) {+ const auto signal = std::make_shared<Parameter>(element::f32, PartialShape{9, 3, 2});+ const auto window = std::make_shared<Parameter>(element::f32, PartialShape{16});+ const auto frame_size = Constant::create<int32_t>(element::i32, {}, {31});+ const auto frame_step = Constant::create<int32_t>(element::i32, {}, {11});+ OV_EXPECT_THROW(std::ignore = make_op(signal, window, frame_size, frame_step, center, normalized),+ NodeValidationFailure,+ HasSubstr("The dimension at data_shape[-3] must be equal to: (frame_size // 2 + 1)"));+}+} // namespace ov::testdiff --git a/src/plugins/intel_cpu/src/cpu_types.cpp b/src/plugins/intel_cpu/src/cpu_types.cppindex afdeec47129..219da020087 100644--- a/src/plugins/intel_cpu/src/cpu_types.cpp+++ b/src/plugins/intel_cpu/src/cpu_types.cpp@@ -186,6 +186,7 @@ static const TypeToNameMap& get_type_to_name_tbl() {{"IDFT", Type::DFT},{"RDFT", Type::RDFT},{"IRDFT", Type::RDFT},+ {"ISTFT", Type::ISTFT},{"STFT", Type::STFT},{"Abs", Type::Math},{"Acos", Type::Math},@@ -347,6 +348,7 @@ std::string NameFromType(const Type type) {CASE(DFT);CASE(RDFT);CASE(STFT);+ CASE(ISTFT);CASE(Math);CASE(CTCLoss);CASE(Bucketize);diff --git a/src/plugins/intel_cpu/src/cpu_types.h b/src/plugins/intel_cpu/src/cpu_types.hindex 3a882618e76..ffe9752efe1 100644--- a/src/plugins/intel_cpu/src/cpu_types.h+++ b/src/plugins/intel_cpu/src/cpu_types.h@@ -90,6 +90,7 @@ enum class Type {DFT,RDFT,STFT,+ ISTFT,Math,CTCLoss,Bucketize,diff --git a/src/plugins/intel_cpu/src/nodes/istft.cpp b/src/plugins/intel_cpu/src/nodes/istft.cppnew file mode 100644index 00000000000..52e77e9a970--- /dev/null+++ b/src/plugins/intel_cpu/src/nodes/istft.cpp@@ -0,0 +1,113 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "istft.h"++#include "nodes/common/cpu_memcpy.h"+#include "openvino/core/type.hpp"+#include "openvino/op/constant.hpp"+#include "openvino/op/istft.hpp"+#include "openvino/reference/istft.hpp"++namespace ov {+namespace intel_cpu {+namespace node {++bool ISTFT::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {+ try {+ if (op->get_type_info() != op::v16::ISTFT::get_type_info_static()) {+ errorMessage = "Only ISTFT operation from the opset16 is supported by the CPU plugin.";+ return false;+ }+ } catch (...) {+ return false;+ }+ return true;+}++ISTFT::ISTFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)+ : Node(op, context, NgraphShapeInferFactory(op)) {+ std::string errorMessage;+ if (!isSupportedOperation(op, errorMessage)) {+ OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);+ }++ const auto istft_op = as_type_ptr<op::v16::ISTFT>(op);++ m_is_frame_size_const = is_type<op::v0::Constant>(istft_op->get_input_node_ptr(FRAME_SIZE_IDX));+ m_is_frame_step_const = is_type<op::v0::Constant>(istft_op->get_input_node_ptr(FRAME_STEP_IDX));+ if (istft_op->get_input_size() > SIGNAL_LENGTH_IDX) {+ m_has_signal_length_input = true;+ m_is_signal_length_const = is_type<op::v0::Constant>(istft_op->get_input_node_ptr(SIGNAL_LENGTH_IDX));+ }+ m_center = istft_op->get_center();+ m_normalized = istft_op->get_normalized();+}++void ISTFT::getSupportedDescriptors() {+ const auto input_size = getParentEdges().size();+ if (input_size < 4 || input_size > 5) {+ THROW_CPU_NODE_ERR("ISTFT has incorrect number of input edges.");+ }+ if (getChildEdges().empty()) {+ THROW_CPU_NODE_ERR("ISTFT has incorrect number of output edges.");+ }+}++void ISTFT::initSupportedPrimitiveDescriptors() {+ if (!supportedPrimitiveDescriptors.empty()) {+ return;+ }++ auto dataPrecision = getOriginalInputPrecisionAtPort(DATA_IDX);+ if (!one_of(dataPrecision, ov::element::f32)) {+ dataPrecision = ov::element::f32;+ }++ std::vector<PortConfigurator> configurators({{LayoutType::ncsp, dataPrecision},+ {LayoutType::ncsp, dataPrecision},+ {LayoutType::ncsp, ov::element::i32},+ {LayoutType::ncsp, ov::element::i32}});+ if (m_has_signal_length_input) {+ configurators.emplace_back(LayoutType::ncsp, ov::element::i32);+ }++ addSupportedPrimDesc(configurators, {{LayoutType::ncsp, dataPrecision}}, impl_desc_type::ref_any);+}++bool ISTFT::needPrepareParams() const {+ return false;+}++bool ISTFT::created() const {+ return getType() == Type::ISTFT;+}++void ISTFT::execute(const dnnl::stream& strm) {+ const auto signal_length =+ m_has_signal_length_input ? (getSrcDataAtPortAs<const int32_t>(SIGNAL_LENGTH_IDX))[0] : -1;+ ov::reference::istft(getSrcDataAtPortAs<const float>(DATA_IDX),+ getSrcDataAtPortAs<const float>(WINDOW_IDX),+ getDstDataAtPortAs<float>(0),+ ov::Shape{getSrcMemoryAtPort(DATA_IDX)->getStaticDims()},+ ov::Shape{getSrcMemoryAtPort(WINDOW_IDX)->getStaticDims()},+ (getSrcDataAtPortAs<const int32_t>(FRAME_SIZE_IDX))[0],+ (getSrcDataAtPortAs<const int32_t>(FRAME_STEP_IDX))[0],+ signal_length,+ m_center,+ m_normalized);+}++void ISTFT::executeDynamicImpl(const dnnl::stream& strm) {+ execute(strm);+}++bool ISTFT::needShapeInfer() const {+ return (m_has_signal_length_input && !m_is_signal_length_const) ||+ (!m_has_signal_length_input && !(m_is_frame_size_const && m_is_frame_step_const)) || Node::needShapeInfer();+}++} // namespace node+} // namespace intel_cpu+} // namespace ovdiff --git a/src/plugins/intel_cpu/src/nodes/istft.h b/src/plugins/intel_cpu/src/nodes/istft.hnew file mode 100644index 00000000000..f9bb6c44f8e--- /dev/null+++ b/src/plugins/intel_cpu/src/nodes/istft.h@@ -0,0 +1,52 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "node.h"++namespace ov {+namespace intel_cpu {+namespace node {++class ISTFT : public Node {+public:+ ISTFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context);++ void getSupportedDescriptors() override;+ void initSupportedPrimitiveDescriptors() override;+ bool created() const override;+ static bool isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept;+ bool needPrepareParams() const override;++ void execute(const dnnl::stream& strm) override;+ void executeDynamicImpl(const dnnl::stream& strm) override;+ bool canBeInPlace() const override {+ return false;+ }++protected:+ bool needShapeInfer() const override;++private:+ /// ISTFT params+ bool m_center = false;+ bool m_normalized = false;++ bool m_is_frame_size_const = false;+ bool m_is_frame_step_const = false;+ bool m_is_signal_length_const = false;+ bool m_has_signal_length_input = false;++ // Input indices+ static constexpr size_t DATA_IDX = 0lu;+ static constexpr size_t WINDOW_IDX = 1lu;+ static constexpr size_t FRAME_SIZE_IDX = 2lu;+ static constexpr size_t FRAME_STEP_IDX = 3lu;+ static constexpr size_t SIGNAL_LENGTH_IDX = 4lu;+};++} // namespace node+} // namespace intel_cpu+} // namespace ovdiff --git a/src/plugins/intel_cpu/src/nodes_factory.cpp b/src/plugins/intel_cpu/src/nodes_factory.cppindex ee7117d8434..6a4fe414d18 100644--- a/src/plugins/intel_cpu/src/nodes_factory.cpp+++ b/src/plugins/intel_cpu/src/nodes_factory.cpp@@ -48,6 +48,7 @@#include "nodes/interaction.h"#include "nodes/interpolate.h"#include "nodes/inverse.hpp"+#include "nodes/istft.h"#include "nodes/llm_mlp.h"#include "nodes/log_softmax.h"#include "nodes/lora.h"@@ -216,6 +217,7 @@ Node::NodesFactory::NodesFactory() : Factory("NodesFactory") {INTEL_CPU_NODE(DFT, Type::DFT);INTEL_CPU_NODE(RDFT, Type::RDFT);INTEL_CPU_NODE(STFT, Type::STFT);+ INTEL_CPU_NODE(ISTFT, Type::ISTFT);INTEL_CPU_NODE(ExtractImagePatches, Type::ExtractImagePatches);INTEL_CPU_NODE(Subgraph, Type::Subgraph);INTEL_CPU_NODE(Composite, Type::SubModel);diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cppindex 4e80268cc38..a86450be239 100644--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp@@ -68,6 +68,7 @@#include "interpolate_shape_inference.hpp"#include "inverse_shape_inference.hpp"#include "irdft_shape_inference.hpp"+#include "istft_shape_inference.hpp"#include "lstm_cell_shape_inference.hpp"#include "lstm_sequence_shape_inference.hpp"#include "matmul_shape_inference.hpp"@@ -438,6 +439,7 @@ using IStaticShapeInferFactory =template <>const IStaticShapeInferFactory::TRegistry IStaticShapeInferFactory::registry{// opset16+ _OV_OP_SHAPE_INFER_MASK_REG(op::v16::ISTFT, ShapeInferTA, util::bit::mask(2, 3, 4)),_OV_OP_SHAPE_INFER_MASK_REG(op::v16::SegmentMax, ShapeInferTA, util::bit::mask(1, 2)),// opset15_OV_OP_SHAPE_INFER_MASK_REG(op::v15::Squeeze, ShapeInferTA, util::bit::mask(1)),diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/istft.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/istft.cppnew file mode 100644index 00000000000..f148e2dd7d3--- /dev/null+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/istft.cpp@@ -0,0 +1,19 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "single_op_tests/istft.hpp"++#include <vector>++#include "common_test_utils/test_constants.hpp"++namespace ov {+namespace test {++INSTANTIATE_TEST_SUITE_P(smoke_ISTFT,+ ISTFTLayerTest,+ ISTFTLayerTest::GetTestDataForDevice(ov::test::utils::DEVICE_CPU),+ ISTFTLayerTest::getTestCaseName);+} // namespace test+} // namespace ovdiff --git a/src/plugins/intel_cpu/tests/unit/shape_inference_test/istft_shape_inference_test.cpp b/src/plugins/intel_cpu/tests/unit/shape_inference_test/istft_shape_inference_test.cppnew file mode 100644index 00000000000..5ecf2cdf239--- /dev/null+++ b/src/plugins/intel_cpu/tests/unit/shape_inference_test/istft_shape_inference_test.cpp@@ -0,0 +1,359 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "istft_shape_inference.hpp"++#include <gtest/gtest.h>++#include "common_test_utils/test_assertions.hpp"+#include "utils.hpp"++using namespace ov;+using namespace ov::intel_cpu;+using ov::op::v0::Constant;+using ov::op::v0::Parameter;+using testing::HasSubstr;++class ISTFTShapeInferenceTest : public OpStaticShapeInferenceTest<op::v16::ISTFT> {};++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_3D_data_no_signal_len) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape({48}));+}++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_4D_data_no_signal_len) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{8, 9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape({8, 48}));+}++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_3D_data_no_signal_len_center) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = true;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape({32}));+}++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_3D_data_with_signal_len) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_signal_len = std::make_shared<Parameter>(step_size_type, ov::PartialShape{-1});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, in_signal_len, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{1}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;+ int32_t signal_len = 60;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}},+ {4, {element::i32, ov::Shape{1}, &signal_len}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape{static_cast<size_t>(signal_len)});+}++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_3D_data_with_signal_len_center) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_signal_len = std::make_shared<Parameter>(step_size_type, ov::PartialShape{-1});++ constexpr bool center = true;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, in_signal_len, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{1}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;+ int32_t signal_len = 60;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}},+ {4, {element::i32, ov::Shape{1}, &signal_len}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape{static_cast<size_t>(signal_len)});+}++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_3D_data_with_signal_len_i64) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i64;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_signal_len = std::make_shared<Parameter>(step_size_type, ov::PartialShape{-1});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, in_signal_len, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{1}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;+ int32_t signal_len = 60;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}},+ {4, {element::i32, ov::Shape{1}, &signal_len}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape{static_cast<size_t>(signal_len)});+}++TEST_F(ISTFTShapeInferenceTest, all_input_as_params_4D_data_with_signal_len) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape::dynamic());+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_signal_len = std::make_shared<Parameter>(step_size_type, ov::PartialShape{-1});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, in_signal_len, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{8, 9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{1}};+ int32_t frame_size = 16;+ int32_t frame_step = 16;+ int32_t signal_len = 60;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}},+ {4, {element::i32, ov::Shape{1}, &signal_len}}};+ auto acc = make_tensor_accessor(const_data);+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], (StaticShape{8, static_cast<size_t>(signal_len)}));+}++TEST_F(ISTFTShapeInferenceTest, inputs_const_3D_data_with_signal_len) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_signal = std::make_shared<Parameter>(data_type, ov::PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, ov::PartialShape{-1});++ int32_t frame_size = 16;+ int32_t frame_step = 16;+ int32_t signal_len = 60;++ const auto in_frame_size = std::make_shared<Constant>(step_size_type, ov::Shape{}, frame_size);+ const auto in_frame_step = std::make_shared<Constant>(step_size_type, ov::Shape{}, frame_step);+ const auto in_signal_len = std::make_shared<Constant>(step_size_type, ov::Shape{}, signal_len);++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_signal, in_window, in_frame_size, in_frame_step, in_signal_len, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{}};++ auto acc = make_tensor_accessor();+ auto static_output_shapes = shape_infer(op.get(), static_input_shapes, acc);+ ASSERT_EQ(static_output_shapes[0], StaticShape{static_cast<size_t>(signal_len)});+}++TEST_F(ISTFTShapeInferenceTest, frame_size_incompatible_value) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_data = std::make_shared<Parameter>(data_type, PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_data, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = -1;+ int32_t frame_step = 16;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);+ OV_EXPECT_THROW(std::ignore = shape_infer(op.get(), static_input_shapes, acc),+ NodeValidationFailure,+ HasSubstr("Provided frame size must be greater than zero, but got: -1"));+}++TEST_F(ISTFTShapeInferenceTest, frame_step_incompatible_value) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_data = std::make_shared<Parameter>(data_type, PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_data, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = 16;+ int32_t frame_step = -1;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);+ OV_EXPECT_THROW(std::ignore = shape_infer(op.get(), static_input_shapes, acc),+ NodeValidationFailure,+ HasSubstr("frame step must be greater than zero, but got: -1"));+}++TEST_F(ISTFTShapeInferenceTest, window_incompatible_dim_with_frame_size) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_data = std::make_shared<Parameter>(data_type, PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_data, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = 8;+ int32_t frame_step = 4;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);++ OV_EXPECT_THROW(std::ignore = shape_infer(op.get(), static_input_shapes, acc),+ NodeValidationFailure,+ HasSubstr("Window input dimension must be in range [1, 8]"));+}++TEST_F(ISTFTShapeInferenceTest, data_shape_incompatible_dim_with_frame_size) {+ const auto data_type = element::f32;+ const auto step_size_type = element::i32;+ const auto in_data = std::make_shared<Parameter>(data_type, PartialShape{-1, -1, -1});+ const auto in_window = std::make_shared<Parameter>(data_type, PartialShape{-1});+ const auto in_frame_size = std::make_shared<Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<Parameter>(step_size_type, ov::Shape{});++ constexpr bool center = false;+ constexpr bool normalized = false;+ const auto op = make_op(in_data, in_window, in_frame_size, in_frame_step, center, normalized);++ std::vector<StaticShape> static_input_shapes = {StaticShape{9, 3, 2},+ StaticShape{16},+ StaticShape{},+ StaticShape{},+ StaticShape{}};+ int32_t frame_size = 31;+ int32_t frame_step = 11;++ auto const_data = std::unordered_map<size_t, Tensor>{{2, {element::i32, ov::Shape{}, &frame_size}},+ {3, {element::i32, ov::Shape{}, &frame_step}}};+ auto acc = make_tensor_accessor(const_data);++ OV_EXPECT_THROW(std::ignore = shape_infer(op.get(), static_input_shapes, acc),+ NodeValidationFailure,+ HasSubstr("The dimension at data_shape[-3] must be equal to: (frame_size // 2 + 1)"));+}\ No newline at end of filediff --git a/src/tests/functional/plugin/shared/include/single_op_tests/istft.hpp b/src/tests/functional/plugin/shared/include/single_op_tests/istft.hppnew file mode 100644index 00000000000..59546cf5d6a--- /dev/null+++ b/src/tests/functional/plugin/shared/include/single_op_tests/istft.hpp@@ -0,0 +1,15 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "shared_test_classes/single_op/istft.hpp"++namespace ov {+namespace test {+TEST_P(ISTFTLayerTest, CompareWithRefs) {+ run();+};+} // namespace test+} // namespace ovdiff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hppindex a383fc2b7df..e3fb87ddbec 100644--- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp+++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp@@ -241,6 +241,7 @@ static std::map<ov::NodeTypeInfo, Range> inputRanges = {{ov::op::v15::BitwiseLeftShift::get_type_info_static(), Range({{0, 5}, {0, 4}}, {})},{ov::op::v15::BitwiseRightShift::get_type_info_static(), Range({{0, 5}, {0, 4}}, {})},{ov::op::v15::STFT::get_type_info_static(), Range({{16, 24}, {1, 16}}, {{0, 1, 10000}, {0, 1, 10000}})},+ {ov::op::v16::ISTFT::get_type_info_static(), Range({{}, {}, {16, 0, 1}, {4, 0, 1}, {64, 0, 1}}, {{0, 1, 10000}, {0, 1, 10000}})},};class ModelRange {diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/istft.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/istft.hppnew file mode 100644index 00000000000..d361903eebf--- /dev/null+++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/istft.hpp@@ -0,0 +1,48 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include <string>+#include <tuple>++#include "common_test_utils/test_enums.hpp"+#include "shared_test_classes/base/ov_subgraph.hpp"++namespace ov {+namespace test {+typedef std::tuple<std::vector<InputShape>,+ int64_t, // frame size value+ int64_t, // frame step value+ int64_t, // signal length value (optional, set test param to -1 to use default)+ bool, // center+ bool, // normalized+ ov::element::Type, // data type+ ov::element::Type, // size/step type+ ov::test::utils::InputLayerType,+ ov::test::TargetDevice>+ ISTFTParams;++class ISTFTLayerTest : public testing::WithParamInterface<ISTFTParams>, virtual public ov::test::SubgraphBaseTest {+public:+ static std::string getTestCaseName(const testing::TestParamInfo<ISTFTParams>& obj);+ using TGenData =+ testing::internal::CartesianProductHolder<testing::internal::ParamGenerator<std::vector<ov::test::InputShape>>,+ testing::internal::ParamGenerator<int64_t>,+ testing::internal::ParamGenerator<int64_t>,+ testing::internal::ParamGenerator<int64_t>,+ testing::internal::ParamGenerator<bool>,+ testing::internal::ParamGenerator<bool>,+ testing::internal::ParamGenerator<ov::element::Type>,+ testing::internal::ParamGenerator<ov::element::Type>,+ testing::internal::ParamGenerator<ov::test::utils::InputLayerType>,+ testing::internal::ValueArray<const char*>>;++ static const TGenData GetTestDataForDevice(const char* deviceName);++protected:+ void SetUp() override;+};+} // namespace test+} // namespace ovdiff --git a/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp b/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cppindex 3d43257ac29..47728a8fcfe 100644--- a/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp+++ b/src/tests/functional/shared_test_classes/src/base/utils/compare_results.cpp@@ -206,6 +206,7 @@ OPENVINO_SUPPRESS_DEPRECATED_START#include "openvino/opsets/opset13_tbl.hpp"#include "openvino/opsets/opset14_tbl.hpp"#include "openvino/opsets/opset15_tbl.hpp"+#include "openvino/opsets/opset16_tbl.hpp"#include "ov_ops/opset_private_tbl.hpp"#undef _OPENVINO_OP_REGdiff --git a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cppindex b8f41c30b55..129f6d446f8 100644--- a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp+++ b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp@@ -1019,6 +1019,7 @@ InputsMap getInputMap() {#include "openvino/opsets/opset13_tbl.hpp"#include "openvino/opsets/opset14_tbl.hpp"#include "openvino/opsets/opset15_tbl.hpp"+#include "openvino/opsets/opset16_tbl.hpp"#include "ov_ops/opset_private_tbl.hpp"#undef _OPENVINO_OP_REGdiff --git a/src/tests/functional/shared_test_classes/src/single_op/istft.cpp b/src/tests/functional/shared_test_classes/src/single_op/istft.cppnew file mode 100644index 00000000000..c9f41a085a9--- /dev/null+++ b/src/tests/functional/shared_test_classes/src/single_op/istft.cpp@@ -0,0 +1,194 @@+// Copyright (C) 2018-2025 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "shared_test_classes/single_op/istft.hpp"++#include "common_test_utils/ov_tensor_utils.hpp"+#include "shared_test_classes/base/utils/ranges.hpp"++namespace ov {+namespace test {++std::string ISTFTLayerTest::getTestCaseName(const testing::TestParamInfo<ISTFTParams>& obj) {+ std::ostringstream result;++ const auto& [data_shapes,+ frame_size,+ frame_step,+ signal_len,+ center,+ normalized,+ data_type,+ step_size_type,+ param_type,+ dev] = obj.param;++ for (size_t s = 0lu; s < 2; s++) {+ const auto& shape_item = data_shapes[s];+ result << "IS" << s << "=(";+ result << shape_item.first;+ result << ")_TS=";++ for (size_t i = 0lu; i < shape_item.second.size(); i++) {+ result << "{";+ result << ov::test::utils::vec2str(shape_item.second[i]);+ result << "}_";+ }+ }++ result << "FrameSize=" << frame_size << "_";+ result << "StepSize=" << frame_step << "_";+ result << "SignalLen=" << signal_len << "_";+ result << "Center=" << center << "_";+ result << "Normalized=" << normalized << "_";+ result << "ModelType=" << data_type << "_";+ result << "StepSizeType=" << step_size_type << "_";+ result << "IsParameterOnly=" << param_type << "_";++ result << "Device=" << dev;+ return result.str();+}++void ISTFTLayerTest::SetUp() {+ const auto& [data_shapes,+ frame_size,+ frame_step,+ signal_len,+ center,+ normalized,+ data_type,+ step_size_type,+ param_type,+ dev] = this->GetParam();+ targetDevice = dev;++ init_input_shapes(data_shapes);++ const auto in_signal = std::make_shared<ov::op::v0::Parameter>(data_type, inputDynamicShapes[0]);+ const auto in_window = std::make_shared<ov::op::v0::Parameter>(data_type, inputDynamicShapes[1]);++ if (param_type == utils::InputLayerType::PARAMETER) {+ const auto in_frame_size = std::make_shared<ov::op::v0::Parameter>(step_size_type, ov::Shape{});+ const auto in_frame_step = std::make_shared<ov::op::v0::Parameter>(step_size_type, ov::Shape{});++ if (signal_len < 0) {+ const auto ISTFT = std::make_shared<ov::op::v16::ISTFT>(in_signal,+ in_window,+ in_frame_size,+ in_frame_step,+ center,+ normalized);+ function =+ std::make_shared<ov::Model>(ISTFT->outputs(),+ ov::ParameterVector{in_signal, in_window, in_frame_size, in_frame_step});++ } else {+ const auto signal_length = std::make_shared<ov::op::v0::Parameter>(step_size_type, ov::Shape{});++ const auto ISTFT = std::make_shared<ov::op::v16::ISTFT>(in_signal,+ in_window,+ in_frame_size,+ in_frame_step,+ signal_length,+ center,+ normalized);+ function = std::make_shared<ov::Model>(+ ISTFT->outputs(),+ ov::ParameterVector{in_signal, in_window, in_frame_size, in_frame_step, signal_length});+ }++ } else {+ const auto in_frame_size = std::make_shared<ov::op::v0::Constant>(step_size_type, ov::Shape{}, frame_size);+ const auto in_frame_step = std::make_shared<ov::op::v0::Constant>(step_size_type, ov::Shape{}, frame_step);++ if (signal_len < 0) {+ const auto ISTFT = std::make_shared<ov::op::v16::ISTFT>(in_signal,+ in_window,+ in_frame_size,+ in_frame_step,+ center,+ normalized);+ function = std::make_shared<ov::Model>(ISTFT->outputs(), ov::ParameterVector{in_signal, in_window});+ } else {+ const auto signal_length = std::make_shared<ov::op::v0::Constant>(step_size_type, ov::Shape{}, signal_len);+ const auto ISTFT = std::make_shared<ov::op::v16::ISTFT>(in_signal,+ in_window,+ in_frame_size,+ in_frame_step,+ signal_length,+ center,+ normalized);+ function = std::make_shared<ov::Model>(ISTFT->outputs(), ov::ParameterVector{in_signal, in_window});+ }+ }+}++const ISTFTLayerTest::TGenData ISTFTLayerTest::GetTestDataForDevice(const char* deviceName) {+ const std::vector<ov::element::Type> data_type = {ov::element::bf16, ov::element::f16, ov::element::f32};+ const std::vector<ov::element::Type> step_size_type = {ov::element::i32, ov::element::i64};++ const std::vector<std::vector<InputShape>> input_shapes = {{+ // Static shapes+ {{}, {{9, 3, 2}}}, // 1st input 3D+ {{}, {{12}}}, // 2nd input+ {{}, {{}}}, // 3rd input+ {{}, {{}}}, // 4th input+ {{}, {{}}} // 5th input+ },+ {+ // Static shapes+ {{}, {{3, 9, 3, 2}}}, // 1st input 4D+ {{}, {{12}}}, // 2nd input+ {{}, {{}}}, // 3rd input+ {{}, {{}}}, // 4th input+ {{}, {{}}} // 5th input+ },+ {+ // Dynamic dims in the first and second input shape+ {{-1, -1, -1}, {{9, 3, 2}}}, // 1st input 3D+ {{-1}, {{12}}}, // 2nd input+ {{}, {{}}}, // 3rd input+ {{}, {{}}}, // 4th input+ {{}, {{}}} // 5th input+ },+ {+ // Dynamic dims in the first and second input shape+ {{-1, -1, -1, -1}, {{4, 9, 3, 2}}}, // 1st input 4D+ {{-1}, {{12}}}, // 2nd input+ {{}, {{}}}, // 3rd input+ {{}, {{}}}, // 4th input+ {{}, {{}}} // 5th input+ }};++ const std::vector<int64_t> frame_size = {16};+ const std::vector<int64_t> step_size = {2, 3, 4};+ const std::vector<int64_t> signal_len = {-1, 48, 32, 256};++ const std::vector<bool> center = {+ false,+ true,+ };++ const std::vector<bool> normalized = {+ false,+ true,+ };++ std::vector<utils::InputLayerType> in_types = {utils::InputLayerType::CONSTANT, utils::InputLayerType::PARAMETER};++ auto data = ::testing::Combine(::testing::ValuesIn(input_shapes),+ ::testing::ValuesIn(frame_size),+ ::testing::ValuesIn(step_size),+ ::testing::ValuesIn(signal_len),+ ::testing::ValuesIn(center),+ ::testing::ValuesIn(normalized),+ ::testing::ValuesIn(data_type),+ ::testing::ValuesIn(step_size_type),+ ::testing::ValuesIn(in_types),+ ::testing::Values(deviceName));++ return data;+}+} // namespace test+} // namespace ov