Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[DFT][CPU] Extend DFT CPU Node to support dynamic shapes (#29940)

Katarzyna Mitrus0ffc2698494f
diff --git a/src/plugins/intel_cpu/src/nodes/dft.cpp b/src/plugins/intel_cpu/src/nodes/dft.cpp
index ffc1d4c0a6e..b5b8e628fe4 100644
--- a/src/plugins/intel_cpu/src/nodes/dft.cpp
+++ b/src/plugins/intel_cpu/src/nodes/dft.cpp
@@ -26,10 +26,6 @@ namespace ov::intel_cpu::node {
bool DFT::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
try {
- if (isDynamicNgraphNode(op)) {
- errorMessage = "Doesn't support op with dynamic shapes";
- return false;
- }
if (!ov::is_type_any_of<const op::v7::DFT, const op::v7::IDFT>(op)) {
errorMessage = "Only opset7 DFT/IDFT operation is supported";
return false;
@@ -47,33 +43,13 @@ DFT::DFT(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
- const size_t inputsNumber = getOriginalInputsNumber();
- if (inputsNumber != 2 && inputsNumber != 3) {
- THROW_CPU_NODE_ERR("has invalid number of input/output edges: ", inputsNumber);
- }
-
- /* Data */
- inputShape = inputShapes[DATA_INDEX].getStaticDims();
- if (inputShape.size() < 2) {
- THROW_CPU_NODE_ERR("has invalid 'data' input tensor with rank: ", inputShape.size());
- }
-
- /* Axes */
- const auto axesRank = inputShapes[AXES_INDEX].getRank();
- if (axesRank != 1) {
- THROW_CPU_NODE_ERR("has invalid 'axes' input tensor with rank: ", axesRank);
- }
-
- /* Signal size */
- if (inputsNumber > SIGNAL_SIZE_INDEX) {
- const auto signalSizeRank = inputShapes[SIGNAL_SIZE_INDEX].getRank();
- if (signalSizeRank != 1) {
- THROW_CPU_NODE_ERR("has invalid 'signal_size' input tensor with rank: ", signalSizeRank);
- }
- }
-
inverse = !ov::is_type<op::v7::DFT>(op);
lastInverse = !inverse;
+
+ m_is_axes_size_const = is_type<op::v0::Constant>(op->get_input_node_ptr(AXES_INDEX));
+ if (inputShapes.size() > SIGNAL_SIZE_INDEX) {
+ m_is_signal_size_const = is_type<op::v0::Constant>(op->get_input_node_ptr(SIGNAL_SIZE_INDEX));
+ }
}
void DFT::getSupportedDescriptors() {}
@@ -247,12 +223,21 @@ void copyDataToOutputWithSignalSize(const float* input,
} // namespace
-void DFT::execute([[maybe_unused]] const dnnl::stream& strm) {
- const auto& outputShape = getChildEdgeAt(0)->getMemory().getStaticDims();
+void DFT::executeDynamicImpl(const dnnl::stream& strm) {
+ execute(strm);
+}
+void DFT::execute([[maybe_unused]] const dnnl::stream& strm) {
const auto inputDataEdge = getParentEdgeAt(DATA_INDEX);
const auto outputDataEdge = getChildEdgeAt(0);
+ const auto& outputShape = outputDataEdge->getMemory().getStaticDims();
+ const auto& inputShape = inputDataEdge->getMemory().getStaticDims();
+
+ if (axes.empty() || !m_is_axes_size_const) {
+ axes = getAxes();
+ }
+
const auto src = inputDataEdge->getMemoryPtr()->getDataAs<const float>();
auto dst = outputDataEdge->getMemoryPtr()->getDataAs<float>();
@@ -549,37 +534,21 @@ bool DFT::created() const {
return getType() == Type::DFT;
}
-void DFT::prepareParams() {
- bool hasDFT = false;
- bool hasFFT = false;
-
- axes = getAxes();
- const auto outputShape = getChildEdgeAt(0)->getMemory().getStaticDims();
-
- for (size_t axis : axes) {
- size_t nComplex = outputShape[axis];
- if (!IsPowerOfTwo(nComplex)) {
- hasDFT = true;
- } else {
- hasFFT = true;
- }
- }
- if (mayiuse(cpu::x64::sse41)) {
- createJITKernels(hasDFT, hasFFT);
- }
-}
-
std::vector<int32_t> DFT::getAxes() const {
auto axesEdge = getParentEdgeAt(AXES_INDEX);
const auto* axesStartPtr = axesEdge->getMemoryPtr()->getDataAs<const int32_t>();
- auto axes = std::vector<int32_t>(axesStartPtr, axesStartPtr + axesEdge->getMemory().getStaticDims()[0]);
- for (auto& axis : axes) {
- if (axis < 0) {
- axis += inputShape.size() - 1;
+ auto axes_tmp = std::vector<int32_t>(axesStartPtr, axesStartPtr + axesEdge->getMemory().getStaticDims()[0]);
+ const auto& inputShape = getParentEdgeAt(DATA_INDEX)->getMemory().getShape();
+ const auto in_shape_rank = inputShape.getRank();
+ if (in_shape_rank > 0) {
+ for (auto& axis : axes_tmp) {
+ if (axis < 0) {
+ axis += in_shape_rank - 1;
+ }
}
}
- std::sort(axes.begin(), axes.end());
- return axes;
+ std::sort(axes_tmp.begin(), axes_tmp.end());
+ return axes_tmp;
}
void DFT::createJITKernels(bool hasDFT, bool hasFFT) {
#if defined(OPENVINO_ARCH_X86_64)
@@ -616,4 +585,41 @@ void DFT::createJITKernels(bool hasDFT, bool hasFFT) {
}
#endif
}
+
+bool DFT::needShapeInfer() const {
+ return !m_is_axes_size_const || !m_is_signal_size_const || Node::needShapeInfer();
+}
+
+bool DFT::needPrepareParams() const {
+ return false;
+}
+
+void DFT::createPrimitive() {
+ if (!outputShapesDefined() || !m_is_axes_size_const) {
+ if (mayiuse(cpu::x64::sse41)) {
+ createJITKernels(true, true);
+ }
+ return;
+ }
+
+ bool hasDFT = false;
+ bool hasFFT = false;
+
+ axes = getAxes();
+ const auto outputShape = getChildEdgeAt(0)->getMemory().getStaticDims();
+
+ for (auto axis : axes) {
+ size_t nComplex = outputShape[axis];
+ if (!IsPowerOfTwo(nComplex)) {
+ hasDFT = true;
+ } else {
+ hasFFT = true;
+ }
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ createJITKernels(hasDFT, hasFFT);
+ }
+ Node::createPrimitive();
+}
+
} // namespace ov::intel_cpu::node
diff --git a/src/plugins/intel_cpu/src/nodes/dft.h b/src/plugins/intel_cpu/src/nodes/dft.h
index 072d59995d5..52668efc0d4 100644
--- a/src/plugins/intel_cpu/src/nodes/dft.h
+++ b/src/plugins/intel_cpu/src/nodes/dft.h
@@ -19,9 +19,11 @@ public:
void getSupportedDescriptors() override;
void initSupportedPrimitiveDescriptors() override;
void execute(const dnnl::stream& strm) override;
+ void executeDynamicImpl(const dnnl::stream& strm) override;
bool created() const override;
-
- void prepareParams() override;
+ void createPrimitive() override;
+ bool needShapeInfer() const override;
+ bool needPrepareParams() const override;
static bool isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept;
@@ -52,7 +54,6 @@ private:
std::unordered_map<size_t, std::vector<float>> twiddlesMapDFT;
std::vector<int32_t> axes;
- std::vector<size_t> inputShape;
const size_t DATA_INDEX = 0;
const size_t AXES_INDEX = 1;
const size_t SIGNAL_SIZE_INDEX = 2;
@@ -60,6 +61,9 @@ private:
bool inverse;
bool lastInverse;
+
+ bool m_is_axes_size_const = false;
+ bool m_is_signal_size_const = false;
};
} // namespace node
diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp
index 5fd5b6966cd..4bf70713bba 100644
--- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp
+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp
@@ -2,23 +2,24 @@
// SPDX-License-Identifier: Apache-2.0
//
+#include "single_op_tests/dft.hpp"
+
#include <vector>
-#include "single_op_tests/dft.hpp"
#include "common_test_utils/test_constants.hpp"
namespace {
using ov::test::DFTLayerTest;
-const std::vector<ov::test::utils::DFTOpType> op_types = {
- ov::test::utils::DFTOpType::FORWARD,
- ov::test::utils::DFTOpType::INVERSE
-};
+const std::vector<ov::test::utils::DFTOpType> op_types = {ov::test::utils::DFTOpType::FORWARD,
+ ov::test::utils::DFTOpType::INVERSE};
-const std::vector<ov::element::Type> input_type = {
- ov::element::f32,
- ov::element::bf16
-};
+const std::vector<ov::element::Type> input_type = {ov::element::f32, ov::element::bf16};
+const std::vector<ov::test::utils::InputLayerType> axes_in_type = {ov::test::utils::InputLayerType::CONSTANT,
+ ov::test::utils::InputLayerType::PARAMETER};
+
+const std::vector<ov::test::utils::InputLayerType> signal_size_in_type = {ov::test::utils::InputLayerType::CONSTANT,
+ ov::test::utils::InputLayerType::PARAMETER};
const std::vector<std::vector<ov::Shape>> input_shapes_static = {
{{10, 4, 20, 32, 2}},
@@ -26,83 +27,84 @@ const std::vector<std::vector<ov::Shape>> input_shapes_static = {
{{1, 120, 128, 1, 2}},
};
-/* 1D DFT */
+const std::vector<std::vector<ov::test::InputShape>> input_shapes = {
+ // Dynamic shapes
+ {{{{-1, 4, 20, 32, 2}}, {{10, 4, 20, 32, 2}, {1, 4, 20, 32, 2}}}},
+ {{{{-1, -1, -1, -1, 2}}, {{2, 5, 7, 8, 2}, {10, 4, 20, 32, 2}}}},
-const std::vector<std::vector<int64_t>> axes1D = {
- {0}, {1}, {2}, {3}, {-2}
+ // Static shapes
+ {{{{10, 4, 20, 32, 2}}, {{10, 4, 20, 32, 2}}}},
+ {{{{2, 5, 7, 8, 2}}, {{2, 5, 7, 8, 2}}}},
+ {{{{1, 120, 128, 1, 2}}, {{1, 120, 128, 1, 2}}}},
};
-const std::vector<std::vector<int64_t>> signalSizes1D = {
- {}, {16}, {40}
-};
+/* 1D DFT */
+
+const std::vector<std::vector<int64_t>> axes1D = {{0}, {1}, {2}, {3}, {-2}};
+const std::vector<std::vector<int64_t>> signalSizes1D = {{}, {16}, {40}};
-const auto testCase1D = ::testing::Combine(
- ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
- ::testing::ValuesIn(input_type),
- ::testing::ValuesIn(axes1D),
- ::testing::ValuesIn(signalSizes1D),
- ::testing::ValuesIn(op_types),
- ::testing::Values(ov::test::utils::DEVICE_CPU)
-);
+const auto testCase1D = ::testing::Combine(::testing::ValuesIn(input_shapes),
+ ::testing::ValuesIn(input_type),
+ ::testing::ValuesIn(axes1D),
+ ::testing::ValuesIn(signalSizes1D),
+ ::testing::ValuesIn(op_types),
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::ValuesIn(axes_in_type),
+ ::testing::ValuesIn(signal_size_in_type));
/* 2D DFT */
-const std::vector<std::vector<int64_t>> axes2D = {
- {0, 1}, {2, 1}, {2, 3}, {2, 0}, {1, 3}, {-1, -2}
-};
-const std::vector<std::vector<int64_t>> signalSizes2D = {
- {}, {5, 7}, {4, 10}, {16, 8}
-};
+const std::vector<std::vector<int64_t>> axes2D = {{0, 1}, {2, 1}, {2, 3}, {2, 0}, {1, 3}, {-1, -2}};
+const std::vector<std::vector<int64_t>> signalSizes2D = {{}, {5, 7}, {4, 10}, {16, 8}};
-const auto testCase2D = ::testing::Combine(
- ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
- ::testing::ValuesIn(input_type),
- ::testing::ValuesIn(axes2D),
- ::testing::ValuesIn(signalSizes2D),
- ::testing::ValuesIn(op_types),
- ::testing::Values(ov::test::utils::DEVICE_CPU)
-);
+const auto testCase2D = ::testing::Combine(::testing::ValuesIn(input_shapes),
+ ::testing::ValuesIn(input_type),
+ ::testing::ValuesIn(axes2D),
+ ::testing::ValuesIn(signalSizes2D),
+ ::testing::ValuesIn(op_types),
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::ValuesIn(axes_in_type),
+ ::testing::ValuesIn(signal_size_in_type));
/* 3D DFT */
const std::vector<std::vector<int64_t>> axes3D = {
- {0, 1, 2}, {1, 2, 3}, {0, 2, 3}, {2, 3, 1}, {-3, -1, -2},
+ {0, 1, 2},
+ {1, 2, 3},
+ {0, 2, 3},
+ {2, 3, 1},
+ {-3, -1, -2},
};
-const std::vector<std::vector<int64_t>> signalSizes3D = {
- {}, {4, 8, 16}, {7, 11, 32}
-};
+const std::vector<std::vector<int64_t>> signalSizes3D = {{}, {4, 8, 16}, {7, 11, 32}};
-const auto testCase3D = ::testing::Combine(
- ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
- ::testing::ValuesIn(input_type),
- ::testing::ValuesIn(axes3D),
- ::testing::ValuesIn(signalSizes3D),
- ::testing::ValuesIn(op_types),
- ::testing::Values(ov::test::utils::DEVICE_CPU)
-);
+const auto testCase3D =
+ ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
+ ::testing::ValuesIn(input_type),
+ ::testing::ValuesIn(axes3D),
+ ::testing::ValuesIn(signalSizes3D),
+ ::testing::ValuesIn(op_types),
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::ValuesIn(axes_in_type),
+ ::testing::ValuesIn(signal_size_in_type));
/* 4D DFT */
-const std::vector<std::vector<int64_t>> axes4D = {
- {0, 1, 2, 3}, {-1, 2, 0, 1}
-};
-
-const std::vector<std::vector<int64_t>> signalSizes4D = {
- {}, {5, 2, 5, 2}
-};
+const std::vector<std::vector<int64_t>> axes4D = {{0, 1, 2, 3}, {-1, 2, 0, 1}};
+const std::vector<std::vector<int64_t>> signalSizes4D = {{}, {5, 2, 5, 2}};
-const auto testCase4D = ::testing::Combine(
- ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
- ::testing::ValuesIn(input_type),
- ::testing::ValuesIn(axes4D),
- ::testing::ValuesIn(signalSizes4D),
- ::testing::ValuesIn(op_types),
- ::testing::Values(ov::test::utils::DEVICE_CPU)
-);
+const auto testCase4D =
+ ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
+ ::testing::ValuesIn(input_type),
+ ::testing::ValuesIn(axes4D),
+ ::testing::ValuesIn(signalSizes4D),
+ ::testing::ValuesIn(op_types),
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::ValuesIn(axes_in_type),
+ ::testing::ValuesIn(signal_size_in_type));
INSTANTIATE_TEST_SUITE_P(smoke_TestsDFT_1d, DFTLayerTest, testCase1D, DFTLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsDFT_2d, DFTLayerTest, testCase2D, DFTLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsDFT_3d, DFTLayerTest, testCase3D, DFTLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_TestsDFT_4d, DFTLayerTest, testCase4D, DFTLayerTest::getTestCaseName);
-} // namespace
+} // namespace
diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp
index 845a8cfdfb9..9ac1b3d1a4b 100644
--- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp
+++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/dft.cpp
@@ -26,7 +26,9 @@ const auto combine = [](const std::vector<std::vector<ov::Shape>>& inputShapes,
testing::ValuesIn(axes),
testing::ValuesIn(signalSizes),
testing::ValuesIn(opTypes),
- testing::Values(ov::test::utils::DEVICE_GPU));
+ testing::Values(ov::test::utils::DEVICE_GPU),
+ testing::Values(ov::test::utils::InputLayerType::CONSTANT),
+ testing::Values(ov::test::utils::InputLayerType::CONSTANT));
};
INSTANTIATE_TEST_SUITE_P(smoke_DFT_2d,
diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp
index fd6115f7dee..84645635efe 100644
--- a/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp
+++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/single_op/dft.hpp
@@ -4,8 +4,8 @@
#pragma once
-#include <tuple>
#include <string>
+#include <tuple>
#include <vector>
#include "common_test_utils/test_enums.hpp"
@@ -13,23 +13,25 @@
namespace ov {
namespace test {
-typedef std::tuple<
- std::vector<InputShape>, // Input shapes
- ov::element::Type, // Model type
- std::vector<int64_t>, // Axes
- std::vector<int64_t>, // Signal size
- ov::test::utils::DFTOpType,
- std::string> DFTParams; // Device name
+typedef std::tuple<std::vector<InputShape>, // Input shapes
+ ov::element::Type, // Model type
+ std::vector<int64_t>, // Axes
+ std::vector<int64_t>, // Signal size
+ ov::test::utils::DFTOpType,
+ std::string, // Device name
+ utils::InputLayerType, // Axes Const/Param
+ utils::InputLayerType // Signal Size Const/Param
+ >
+ DFTParams;
-class DFTLayerTest : public testing::WithParamInterface<DFTParams>,
- virtual public ov::test::SubgraphBaseTest {
+class DFTLayerTest : public testing::WithParamInterface<DFTParams>, virtual public ov::test::SubgraphBaseTest {
public:
static std::string getTestCaseName(const testing::TestParamInfo<DFTParams>& obj);
protected:
- //TO DO, to be removed after 125993
+ // TO DO, to be removed after 125993
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override;
void SetUp() override;
};
-} // namespace test
-} // namespace ov
+} // namespace test
+} // namespace ov
diff --git a/src/tests/functional/shared_test_classes/src/single_op/dft.cpp b/src/tests/functional/shared_test_classes/src/single_op/dft.cpp
index af7fbd954c7..25d8f94ed35 100644
--- a/src/tests/functional/shared_test_classes/src/single_op/dft.cpp
+++ b/src/tests/functional/shared_test_classes/src/single_op/dft.cpp
@@ -3,6 +3,7 @@
//
#include "shared_test_classes/single_op/dft.hpp"
+
#include "common_test_utils/node_builders/dft.hpp"
#include "common_test_utils/ov_tensor_utils.hpp"
#include "shared_test_classes/base/utils/ranges.hpp"
@@ -15,13 +16,8 @@ static inline void set_real_number_generation_data(utils::InputGenerateData& inG
}
void DFTLayerTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
- std::vector<InputShape> shapes;
- ov::element::Type model_type;
- std::vector<int64_t> axes;
- std::vector<int64_t> signal_size;
- ov::test::utils::DFTOpType op_type;
- std::string target_device;
- std::tie(shapes, model_type, axes, signal_size, op_type, target_device) = GetParam();
+ const auto& [shapes, model_type, axes, signal_size, op_type, target_device, axes_in_type, size_in_type] =
+ this->GetParam();
auto elemType = model_type;
bool inPrcSigned = elemType.is_signed();
@@ -49,19 +45,28 @@ void DFTLayerTest::generate_inputs(const std::vector<ov::Shape>& targetInputStat
inputs.clear();
Tensor data_tensor = ov::test::utils::create_and_fill_tensor_act_dft(funcInput->get_element_type(),
- targetInputStaticShapes[0],
- inGenData.range, inGenData.start_from, inGenData.resolution, inGenData.seed);
+ targetInputStaticShapes[0],
+ inGenData.range,
+ inGenData.start_from,
+ inGenData.resolution,
+ inGenData.seed);
inputs.insert({funcInput->get_node_shared_ptr(), data_tensor});
+
+ if (axes_in_type == utils::InputLayerType::PARAMETER) {
+ auto tensor_axes = ov::Tensor(ov::element::i64, ov::Shape({axes.size()}));
+ std::memcpy(tensor_axes.data(), &axes[0], axes.size() * sizeof(int64_t));
+ inputs.insert({funcInputs[1].get_node_shared_ptr(), tensor_axes});
+ }
+
+ if (size_in_type == utils::InputLayerType::PARAMETER && signal_size.size() > 0) {
+ auto tensor_sizes = ov::Tensor(ov::element::i64, ov::Shape({signal_size.size()}));
+ std::memcpy(tensor_sizes.data(), &signal_size[0], signal_size.size() * sizeof(int64_t));
+ inputs.insert({funcInputs.back().get_node_shared_ptr(), tensor_sizes});
+ }
}
std::string DFTLayerTest::getTestCaseName(const testing::TestParamInfo<DFTParams>& obj) {
- std::vector<InputShape> shapes;
- ov::element::Type model_type;
- std::vector<int64_t> axes;
- std::vector<int64_t> signal_size;
- ov::test::utils::DFTOpType op_type;
- std::string target_device;
- std::tie(shapes, model_type, axes, signal_size, op_type, target_device) = obj.param;
+ const auto& [shapes, model_type, axes, signal_size, op_type, target_device, axes_in_type, size_in_type] = obj.param;
std::ostringstream result;
result << "IS=(";
@@ -80,25 +85,25 @@ std::string DFTLayerTest::getTestCaseName(const testing::TestParamInfo<DFTParams
result << "Axes=" << ov::test::utils::vec2str(axes) << "_";
result << "signal_size=" << ov::test::utils::vec2str(signal_size) << "_";
result << "Inverse=" << (op_type == ov::test::utils::DFTOpType::INVERSE) << "_";
- result << "TargetDevice=" << target_device;
+ result << "TargetDevice=" << target_device << "_";
+ result << "AxesInType=" << axes_in_type << "";
+ result << "SizeInType=" << size_in_type << "";
+
return result.str();
}
void DFTLayerTest::SetUp() {
- std::vector<InputShape> shapes;
- ov::element::Type model_type;
- std::vector<int64_t> axes;
- std::vector<int64_t> signal_size;
- ov::test::utils::DFTOpType op_type;
- std::tie(shapes, model_type, axes, signal_size, op_type, targetDevice) = this->GetParam();
+ const auto& [shapes, model_type, axes, signal_size, op_type, dev, axes_in_type, size_in_type] = this->GetParam();
+ targetDevice = dev;
+
init_input_shapes(shapes);
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
-
- auto dft = ov::test::utils::make_dft(param, axes, signal_size, op_type);
+ ov::ParameterVector in_parameters{param};
+ auto dft = ov::test::utils::make_dft(in_parameters, axes, signal_size, op_type, axes_in_type, size_in_type);
auto result = std::make_shared<ov::op::v0::Result>(dft);
- function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "DFT");
+ function = std::make_shared<ov::Model>(result, in_parameters, "DFT");
if (model_type == ov::element::f32) {
abs_threshold = 8e-5;
diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/dft.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/dft.hpp
index 1377b8d1167..1b90dab42cf 100644
--- a/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/dft.hpp
+++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/dft.hpp
@@ -11,10 +11,12 @@
namespace ov {
namespace test {
namespace utils {
-std::shared_ptr<ov::Node> make_dft(const ov::Output<Node>& data_node,
+std::shared_ptr<ov::Node> make_dft(ov::ParameterVector& parameters,
const std::vector<int64_t>& axes,
const std::vector<int64_t>& signal_size,
- const ov::test::utils::DFTOpType op_type);
+ const ov::test::utils::DFTOpType op_type,
+ utils::InputLayerType axes_in_type = utils::InputLayerType::CONSTANT,
+ utils::InputLayerType size_in_type = utils::InputLayerType::PARAMETER);
} // namespace utils
} // namespace test
} // namespace ov
\ No newline at end of file
diff --git a/src/tests/test_utils/common_test_utils/src/node_builders/dft.cpp b/src/tests/test_utils/common_test_utils/src/node_builders/dft.cpp
index 62662d3e79e..72144a7f346 100644
--- a/src/tests/test_utils/common_test_utils/src/node_builders/dft.cpp
+++ b/src/tests/test_utils/common_test_utils/src/node_builders/dft.cpp
@@ -25,19 +25,33 @@ std::shared_ptr<ov::Node> CallDftCtorWithArgs(const ov::test::utils::DFTOpType o
}
} // namespace
-std::shared_ptr<ov::Node> make_dft(const ov::Output<Node>& data_node,
+std::shared_ptr<ov::Node> make_dft(ov::ParameterVector& parameters,
const std::vector<int64_t>& axes,
const std::vector<int64_t>& signal_size,
- const ov::test::utils::DFTOpType op_type) {
- auto axesNode = std::make_shared<ov::op::v0::Constant>(ov::element::Type_t::i64, ov::Shape{axes.size()}, axes);
+ const ov::test::utils::DFTOpType op_type,
+ utils::InputLayerType axes_in_type,
+ utils::InputLayerType size_in_type) {
+ std::shared_ptr<ov::Node> signal_size_node;
+ std::shared_ptr<ov::Node> axes_node;
+
+ if (axes_in_type == utils::InputLayerType::PARAMETER) {
+ axes_node = parameters.emplace_back(std::make_shared<ov::op::v0::Parameter>(element::i64, Shape{axes.size()}));
+ } else {
+ axes_node = std::make_shared<ov::op::v0::Constant>(ov::element::Type_t::i64, ov::Shape{axes.size()}, axes);
+ }
if (!signal_size.empty()) {
- auto signal_size_node = std::make_shared<ov::op::v0::Constant>(ov::element::Type_t::i64,
- ov::Shape{signal_size.size()},
- signal_size);
- return CallDftCtorWithArgs(op_type, data_node, axesNode, signal_size_node);
+ if (size_in_type == utils::InputLayerType::PARAMETER) {
+ signal_size_node = parameters.emplace_back(
+ std::make_shared<ov::op::v0::Parameter>(element::i64, Shape{signal_size.size()}));
+ } else {
+ signal_size_node = std::make_shared<ov::op::v0::Constant>(ov::element::Type_t::i64,
+ ov::Shape{signal_size.size()},
+ signal_size);
+ }
+ return CallDftCtorWithArgs(op_type, parameters[0], axes_node, signal_size_node);
}
- return CallDftCtorWithArgs(op_type, data_node, axesNode);
+ return CallDftCtorWithArgs(op_type, parameters[0], axes_node);
}
} // namespace utils
} // namespace test
diff --git a/tests/model_hub_tests/pytorch/hf_transformers_models b/tests/model_hub_tests/pytorch/hf_transformers_models
index c861c0cb6c6..cc67f8d1929 100644
--- a/tests/model_hub_tests/pytorch/hf_transformers_models
+++ b/tests/model_hub_tests/pytorch/hf_transformers_models
@@ -71,7 +71,7 @@ fastspeech2_conformer_with_hifigan,espnet/fastspeech2_conformer_with_hifigan,xfa
flaubert,lincoln/flaubert-mlsum-topic-classification
flava,facebook/flava-full
flava_image_codebook,facebook/flava-image-codebook
-fnet,google/fnet-base,xfail,Unsupported op aten::fft_fftn aten::real
+fnet,google/fnet-base
focalnet,microsoft/focalnet-small
fsmt,facebook/wmt19-en-ru,xfail,Trace error: Only tensors lists tuples of tensors or dictionary of tensors can be output from traced functions
funnel,funnel-transformer/small