Skip to content

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

[CPU][ARM] Enable SLT Interpolate tests on ARM (#26039)

Aleksandr Voron267e6f9de949
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
index 5c74293d04d..33bd49e2f04 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
@@ -187,6 +187,13 @@ bool ov::intel_cpu::ACLInterpolateExecutorBuilder::isSupported(const ov::intel_c
return false;
}
+ if (interpolateAttrs.shapeCalcMode == InterpolateShapeCalcMode::scales &&
+ one_of(interpolateAttrs.coordTransMode, InterpolateCoordTransMode::half_pixel, InterpolateCoordTransMode::asymmetric) &&
+ one_of(interpolateAttrs.mode, InterpolateMode::linear, InterpolateMode::linear_onnx)) {
+ DEBUG_LOG("ACL Interpolate does not support scales mode with linear/linear_onnx and half_pixel/asymmetric");
+ return false;
+ }
+
if (interpolateAttrs.mode == InterpolateMode::nearest &&
!isSupportedConfiguration(interpolateAttrs, srcDescs, dstDescs)) {
DEBUG_LOG("ACL Interpolate isSupportedConfiguration method fails for nearest mode");
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.hpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.hpp
index 263619735ff..17cdfec5928 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.hpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.hpp
@@ -4,7 +4,7 @@
#pragma once
-#include "../interpolate.hpp"
+#include "nodes/executors/interpolate.hpp"
#include "arm_compute/runtime/NEON/functions/NEScale.h"
#include "arm_compute/runtime/Tensor.h"
diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp
index d28c4af323b..15df4eed5f0 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp
@@ -48,6 +48,7 @@ enum class InterpolateShapeCalcMode {
};
struct InterpolateAttrs {
+ InterpolateShapeCalcMode shapeCalcMode = InterpolateShapeCalcMode::sizes;
InterpolateMode mode = InterpolateMode::nearest;
InterpolateCoordTransMode coordTransMode = InterpolateCoordTransMode::half_pixel;
InterpolateNearestMode nearestMode = InterpolateNearestMode::round_prefer_floor;
diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp
index b81a2c89cff..a04834fd55f 100644
--- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp
@@ -1862,9 +1862,9 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext
const auto &interpShapeCalcMode = interpAttr.shape_calculation_mode;
if (interpShapeCalcMode == ngInterpShapeCalcMode::SCALES) {
- shapeCalcMode = InterpolateShapeCalcMode::scales;
+ interpAttrs.shapeCalcMode = InterpolateShapeCalcMode::scales;
} else if (interpShapeCalcMode == ngInterpShapeCalcMode::SIZES) {
- shapeCalcMode = InterpolateShapeCalcMode::sizes;
+ interpAttrs.shapeCalcMode = InterpolateShapeCalcMode::sizes;
} else {
OPENVINO_THROW(errorPrefix, " has unsupported shape calculation mode");
}
@@ -1925,14 +1925,14 @@ Interpolate::Interpolate(const std::shared_ptr<ov::Node>& op, const GraphContext
const auto &interpShapeCalcMode = interpAttr.shape_calculation_mode;
if (interpShapeCalcMode == ngInterpShapeCalcMode::SCALES) {
- shapeCalcMode = InterpolateShapeCalcMode::scales;
+ interpAttrs.shapeCalcMode = InterpolateShapeCalcMode::scales;
const auto scalesNode = std::dynamic_pointer_cast<const ov::op::v0::Constant>(interp->get_input_node_shared_ptr(SIZE_OR_SCALE_ID_V11));
if (scalesNode) {
scales = scalesNode->cast_vector<float>();
isScaleConstant = true;
}
} else if (interpShapeCalcMode == ngInterpShapeCalcMode::SIZES) {
- shapeCalcMode = InterpolateShapeCalcMode::sizes;
+ interpAttrs.shapeCalcMode = InterpolateShapeCalcMode::sizes;
} else {
OPENVINO_THROW(errorPrefix, " has unsupported shape calculation mode");
}
@@ -2074,7 +2074,7 @@ void Interpolate::initSupportedPrimitiveDescriptors() {
auto pushDesc = [&](LayoutType dataFormat, impl_desc_type implDetail, bool is_version11, bool useAclExecutor = false) {
config.inConfs[DATA_ID].setMemDesc(creatorsMap.at(dataFormat)->createSharedDesc(inputPrecision, getInputShapeAtPort(DATA_ID)));
if (is_version11) {
- if (shapeCalcMode == InterpolateShapeCalcMode::sizes) {
+ if (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::sizes) {
config.inConfs[SIZE_OR_SCALE_ID_V11].setMemDesc(
creatorsMap.at(LayoutType::ncsp)->createSharedDesc(targetShapeType, getInputShapeAtPort(SIZE_OR_SCALE_ID_V11)));
} else {
@@ -2198,7 +2198,7 @@ bool Interpolate::needShapeInfer() const {
if (Node::inputShapesModified()) {
return true;
}
- if (shapeCalcMode == InterpolateShapeCalcMode::scales) {
+ if (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::scales) {
if (lastScales.empty()) {
return true;
}
@@ -2225,9 +2225,9 @@ bool Interpolate::needShapeInfer() const {
void Interpolate::executeDynamicImpl(dnnl::stream strm) {
execute(strm);
- const size_t port = shapeCalcMode == InterpolateShapeCalcMode::sizes ? TARGET_SHAPE_ID : get_scale_id();
+ const size_t port = interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::sizes ? TARGET_SHAPE_ID : get_scale_id();
const auto &memory = getParentEdgeAt(port)->getMemory();
- if (shapeCalcMode == InterpolateShapeCalcMode::scales) {
+ if (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::scales) {
const float *scales = memory.getDataAs<const float>();
lastScales.assign(scales, scales + memory.getDesc().getShape().getElementsCount());
} else {
@@ -2268,7 +2268,7 @@ void Interpolate::prepareParams() {
if (!srcMemPtr || !srcMemPtr->isAllocated())
OPENVINO_THROW(errorPrefix, " did not allocate input memory");
- if (shapeCalcMode == InterpolateShapeCalcMode::sizes) {
+ if (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::sizes) {
auto tsMemPtr = getSrcMemoryAtPort(TARGET_SHAPE_ID);
if (!tsMemPtr || !tsMemPtr->isAllocated())
OPENVINO_THROW(errorPrefix, " did not allocate target shape memory");
@@ -2307,7 +2307,7 @@ void Interpolate::prepareParams() {
interpAttrs.layout = InterpolateLayoutType::by_channel;
}
- if (shapeCalcMode == InterpolateShapeCalcMode::scales) {
+ if (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::scales) {
if (!isScaleConstant) {
const auto& scalesMem = getParentEdgeAt(get_scale_id())->getMemory();
const float* scalesData = scalesMem.getDataAs<const float>();
@@ -2460,7 +2460,7 @@ std::vector<float> Interpolate::getScales(const VectorDims &srcDimPad, const Vec
if (interpAttrs.mode == InterpolateMode::bilinear_pillow || interpAttrs.mode == InterpolateMode::bicubic_pillow) {
fullScales[axis] = static_cast<float>(dstDim[axis]) / static_cast<float>(srcDimPad[axis]);
} else {
- fullScales[axis] = (shapeCalcMode == InterpolateShapeCalcMode::scales) ? scales[i] :
+ fullScales[axis] = (interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::scales) ? scales[i] :
static_cast<float>(dstDim[axis]) / static_cast<float>(srcDimPad[axis]);
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.h b/src/plugins/intel_cpu/src/nodes/interpolate.h
index e8d09ee2402..11f0e3104e5 100644
--- a/src/plugins/intel_cpu/src/nodes/interpolate.h
+++ b/src/plugins/intel_cpu/src/nodes/interpolate.h
@@ -223,7 +223,6 @@ private:
static size_t getSpatialDimsNum(const Dim rank);
bool hasPad = false;
- InterpolateShapeCalcMode shapeCalcMode = InterpolateShapeCalcMode::sizes;
bool isAxesSpecified = false;
std::vector<int> axes;
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/interpolate.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/interpolate.cpp
new file mode 100644
index 00000000000..3b36a2fef06
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/interpolate.cpp
@@ -0,0 +1,264 @@
+// Copyright (C) 2024 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "interpolate.hpp"
+#include "gtest/gtest.h"
+#include "utils/cpu_test_utils.hpp"
+#include "utils/general_utils.h"
+#include "openvino/pass/manager.hpp"
+#include "transformations/op_conversions/convert_interpolate11_downgrade.hpp"
+
+using namespace CPUTestUtils;
+using namespace ov::intel_cpu;
+
+namespace ov {
+namespace test {
+
+std::string InterpolateLayerCPUTest::getTestCaseName(testing::TestParamInfo<InterpolateLayerCPUTestParamsSet> obj) {
+ InterpolateSpecificParams specificParams;
+ ShapeParams shapeParams;
+ ElementType prec;
+ CPUSpecificParams cpuParams;
+ fusingSpecificParams fusingParams;
+ ov::AnyMap additionalConfig;
+ std::tie(specificParams, shapeParams, prec, cpuParams, fusingParams, additionalConfig) = obj.param;
+
+ ov::op::v11::Interpolate::InterpolateMode mode;
+ ov::op::v11::Interpolate::CoordinateTransformMode transfMode;
+ ov::op::v11::Interpolate::NearestMode nearMode;
+ bool antiAlias;
+ std::vector<size_t> padBegin;
+ std::vector<size_t> padEnd;
+ double cubeCoef;
+ std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
+
+ ov::op::v11::Interpolate::ShapeCalcMode shapeCalcMode;
+ InputShape inputShapes;
+ ov::test::utils::InputLayerType shapeInputType;
+ std::vector<std::vector<float>> shapeDataForInput;
+ std::vector<int64_t> axes;
+ std::tie(shapeCalcMode, inputShapes, shapeInputType, shapeDataForInput, axes) = shapeParams;
+
+ using ov::test::utils::operator<<;
+ std::ostringstream result;
+ result << "ShapeCalcMode=" << shapeCalcMode << "_";
+ result << "IS=";
+ result << ov::test::utils::partialShape2str({inputShapes.first}) << "_";
+ result << "TS=";
+ for (const auto& shape : inputShapes.second) {
+ result << ov::test::utils::vec2str(shape) << "_";
+ }
+ if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
+ result << "Scales=";
+ } else {
+ result << "Sizes=";
+ }
+ for (const auto &data : shapeDataForInput) {
+ result << ov::test::utils::vec2str(data) << "_";
+ }
+ result << shapeInputType << "_";
+ result << "InterpolateMode=" << mode << "_";
+ result << "CoordinateTransformMode=" << transfMode << "_";
+ result << "NearestMode=" << nearMode << "_";
+ result << "CubeCoef=" << cubeCoef << "_";
+ result << "Antialias=" << antiAlias << "_";
+ result << "PB=" << ov::test::utils::vec2str(padBegin) << "_";
+ result << "PE=" << ov::test::utils::vec2str(padEnd) << "_";
+ result << "Axes=" << ov::test::utils::vec2str(axes) << "_";
+ result << "PRC=" << prec << "_";
+
+ result << CPUTestsBase::getTestCaseName(cpuParams);
+ result << CpuTestWithFusing::getTestCaseName(fusingParams);
+
+ if (!additionalConfig.empty()) {
+ result << "_PluginConf";
+ for (auto& item : additionalConfig) {
+ result << "_" << item.first << "=" << item.second.as<std::string>();
+ }
+ }
+
+ return result.str();
+}
+
+void InterpolateLayerCPUTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
+ inputs.clear();
+ const auto& funcInputs = function->inputs();
+ for (size_t i = 0; i < funcInputs.size(); ++i) {
+ const auto& funcInput = funcInputs[i];
+ ov::Tensor tensor;
+
+ if (i == 1) {
+ if (shapeCalcMode == ov::op::v4::Interpolate::ShapeCalcMode::SIZES) {
+ tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], sizes[inferRequestNum].data());
+ } else {
+ tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], scales[inferRequestNum].data());
+ }
+ } else {
+ ov::test::utils::InputGenerateData in_data;
+ in_data.start_from = 0;
+ in_data.range = 2560;
+ in_data.resolution = 256;
+ tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], in_data);
+ }
+
+ inputs.insert({funcInput.get_node_shared_ptr(), tensor});
+ }
+ inferRequestNum++;
+}
+
+void InterpolateLayerCPUTest::configure_model() {
+ ov::preprocess::PrePostProcessor p(function);
+ {
+ auto& params = function->get_parameters();
+ for (size_t i = 0; i < params.size(); i++) {
+ if (i > 0) {
+ continue;
+ }
+ if (inType != ov::element::Type_t::undefined) {
+ p.input(i).tensor().set_element_type(inType);
+ }
+ }
+ }
+ {
+ auto results = function->get_results();
+ for (size_t i = 0; i < results.size(); i++) {
+ if (outType != ov::element::Type_t::undefined) {
+ p.output(i).tensor().set_element_type(outType);
+ }
+ }
+ }
+ function = p.build();
+}
+
+void InterpolateLayerCPUTest::SetUp() {
+ targetDevice = ov::test::utils::DEVICE_CPU;
+
+ InterpolateSpecificParams specificParams;
+ ShapeParams shapeParams;
+ ElementType ngPrc;
+ CPUSpecificParams cpuParams;
+ fusingSpecificParams fusingParams;
+ ov::AnyMap additionalConfig;
+ std::tie(specificParams, shapeParams, ngPrc, cpuParams, fusingParams, additionalConfig) = this->GetParam();
+
+ std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
+ std::tie(postOpMgrPtr, fusedOps) = fusingParams;
+ configuration.insert(additionalConfig.begin(), additionalConfig.end());
+
+ ov::op::v11::Interpolate::InterpolateMode mode;
+ ov::op::v11::Interpolate::CoordinateTransformMode transfMode;
+ ov::op::v11::Interpolate::NearestMode nearMode;
+ bool antiAlias;
+ std::vector<size_t> padBegin;
+ std::vector<size_t> padEnd;
+ double cubeCoef;
+ std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
+
+ InputShape dataShape;
+ ov::test::utils::InputLayerType shapeInputType;
+ std::vector<std::vector<float>> shapeDataForInput;
+ std::vector<int64_t> axes;
+ std::tie(shapeCalcMode, dataShape, shapeInputType, shapeDataForInput, axes) = shapeParams;
+
+ if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
+ scales = shapeDataForInput;
+ } else {
+ sizes.resize(shapeDataForInput.size());
+ for (size_t i = 0; i < shapeDataForInput.size(); i++) {
+ for (size_t j = 0; j < shapeDataForInput[i].size(); j++) {
+ sizes[i].push_back(shapeDataForInput[i][j]);
+ }
+ }
+ }
+
+ std::vector<InputShape> inputShapes;
+ inputShapes.push_back(dataShape);
+ if (shapeInputType == ov::test::utils::InputLayerType::PARAMETER) {
+ inputShapes.push_back(InputShape({static_cast<int64_t>(axes.size())}, std::vector<ov::Shape>(dataShape.second.size(), {axes.size()})));
+ }
+
+ auto it = additionalConfig.find(ov::hint::inference_precision.name());
+ if (it != additionalConfig.end() && it->second.as<ov::element::Type>() == ov::element::bf16) {
+ inType = outType = ngPrc = ElementType::bf16;
+ rel_threshold = 1e-2f;
+ } else if (it != additionalConfig.end() && it->second.as<ov::element::Type>() == ov::element::f16) {
+ inType = outType = ngPrc = ElementType::f16;
+ rel_threshold = 1e-2f;
+ } else {
+ inType = outType = ngPrc;
+ }
+
+ init_input_shapes(inputShapes);
+
+ ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(ngPrc, inputDynamicShapes.front())};
+ std::shared_ptr<ov::Node> sizesInput, scalesInput;
+ if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
+ if (shapeInputType == ov::test::utils::InputLayerType::PARAMETER) {
+ auto paramNode = std::make_shared<ov::op::v0::Parameter>(ElementType::f32, ov::Shape{scales.front().size()});
+ params.push_back(paramNode);
+ scalesInput = paramNode;
+ } else {
+ scalesInput = std::make_shared<ov::op::v0::Constant>(ElementType::f32, ov::Shape{scales.front().size()}, scales.front());
+ }
+ } else {
+ if (shapeInputType == ov::test::utils::InputLayerType::PARAMETER) {
+ auto paramNode = std::make_shared<ov::op::v0::Parameter>(ElementType::i32, ov::Shape{sizes.front().size()});
+ params.push_back(paramNode);
+ sizesInput = paramNode;
+ } else {
+ sizesInput = std::make_shared<ov::op::v0::Constant>(ElementType::i32, ov::Shape{sizes.front().size()}, sizes.front());
+ }
+ }
+ auto axesInput = std::make_shared<ov::op::v0::Constant>(ElementType::i64, ov::Shape{axes.size()}, axes);
+
+ for (size_t i = 0; i < params.size(); i++) {
+ params[i]->set_friendly_name(std::string("param_") + std::to_string(i));
+ }
+
+ ov::op::v11::Interpolate::InterpolateAttrs interpAttr{mode, shapeCalcMode, padBegin, padEnd, transfMode, nearMode,
+ antiAlias, cubeCoef};
+
+ std::shared_ptr<ov::op::v11::Interpolate> interp = nullptr;
+ if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
+ interp = std::make_shared<ov::op::v11::Interpolate>(params[0], scalesInput, axesInput, interpAttr);
+ } else {
+ interp = std::make_shared<ov::op::v11::Interpolate>(params[0], sizesInput, axesInput, interpAttr);
+ }
+
+ function = makeNgraphFunction(ngPrc, params, interp, "InterpolateCPU");
+
+ ov::pass::Manager m;
+ m.register_pass<ov::pass::ConvertInterpolate11ToInterpolate4>();
+ m.run_passes(function);
+ if (selectedType.empty()) {
+ selectedType = getPrimitiveType();
+ }
+ selectedType = makeSelectedTypeStr(selectedType, ngPrc);
+}
+
+TEST_P(InterpolateLayerCPUTest, CompareWithRefs) {
+ run();
+ CheckPluginRelatedResults(compiledModel, "Interpolate");
+}
+
+
+namespace Interpolate {
+const std::vector<ov::op::v11::Interpolate::NearestMode> defNearestModes() {
+ static const std::vector<ov::op::v11::Interpolate::NearestMode> defNearestModes {
+ ov::op::v11::Interpolate::NearestMode::ROUND_PREFER_FLOOR
+ };
+ return defNearestModes;
+}
+
+const std::vector<bool> antialias() {
+ return { false };
+}
+
+const std::vector<double> cubeCoefs() {
+ return { -0.75f };
+}
+
+} // namespace Interpolate
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/interpolate.hpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/interpolate.hpp
new file mode 100644
index 00000000000..c9614cd2f49
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/interpolate.hpp
@@ -0,0 +1,60 @@
+// Copyright (C) 2018-2024 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "shared_test_classes/base/ov_subgraph.hpp"
+#include "utils/fusing_test_utils.hpp"
+
+using namespace CPUTestUtils;
+
+namespace ov {
+namespace test {
+
+using InterpolateSpecificParams =
+ std::tuple<ov::op::v11::Interpolate::InterpolateMode, // InterpolateMode
+ ov::op::v11::Interpolate::CoordinateTransformMode, // CoordinateTransformMode
+ ov::op::v11::Interpolate::NearestMode, // NearestMode
+ bool, // AntiAlias
+ std::vector<size_t>, // PadBegin
+ std::vector<size_t>, // PadEnd
+ double>; // Cube coef
+
+using ShapeParams = std::tuple<ov::op::v11::Interpolate::ShapeCalcMode, // ShapeCalculationMode
+ InputShape, // Input shapes
+ // params describing input, choice of which depends on ShapeCalcMode
+ ov::test::utils::InputLayerType, // input type
+ std::vector<std::vector<float>>, // scales or sizes values
+ std::vector<int64_t>>; // axes
+
+using InterpolateLayerCPUTestParamsSet = std::tuple<InterpolateSpecificParams,
+ ShapeParams,
+ ElementType,
+ CPUSpecificParams,
+ fusingSpecificParams,
+ ov::AnyMap>;
+
+class InterpolateLayerCPUTest : public testing::WithParamInterface<InterpolateLayerCPUTestParamsSet>,
+ virtual public SubgraphBaseTest, public CpuTestWithFusing {
+public:
+ static std::string getTestCaseName(testing::TestParamInfo<InterpolateLayerCPUTestParamsSet> obj);
+ void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override;
+ void configure_model() override;
+
+protected:
+ std::vector<std::vector<float>> scales;
+ std::vector<std::vector<int32_t>> sizes;
+ ov::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
+ size_t inferRequestNum = 0;
+
+ void SetUp() override;
+};
+
+namespace Interpolate {
+ const std::vector<ov::op::v11::Interpolate::NearestMode> defNearestModes();
+ const std::vector<bool> antialias();
+ const std::vector<double> cubeCoefs();
+} // namespace Interpolate
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/interpolate.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/interpolate.cpp
new file mode 100644
index 00000000000..0463d25924c
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/interpolate.cpp
@@ -0,0 +1,237 @@
+// Copyright (C) 2018-2024 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "custom/single_layer_tests/classes/interpolate.hpp"
+#include "common_test_utils/ov_tensor_utils.hpp"
+#include "openvino/core/preprocess/pre_post_process.hpp"
+#include "shared_test_classes/base/ov_subgraph.hpp"
+#include "utils/cpu_test_utils.hpp"
+#include "utils/fusing_test_utils.hpp"
+
+using namespace CPUTestUtils;
+
+namespace ov {
+namespace test {
+namespace Interpolate {
+
+const std::vector<ov::op::v11::Interpolate::CoordinateTransformMode> coordinateTransformModes_Full = {
+ ov::op::v11::Interpolate::CoordinateTransformMode::HALF_PIXEL,
+ ov::op::v11::Interpolate::CoordinateTransformMode::ASYMMETRIC,
+ ov::op::v11::Interpolate::CoordinateTransformMode::ALIGN_CORNERS
+};
+
+const std::vector<ov::op::v11::Interpolate::NearestMode> interpolateNearestModes = {
+ ov::op::v11::Interpolate::NearestMode::SIMPLE,
+ ov::op::v11::Interpolate::NearestMode::FLOOR
+};
+
+const std::vector<fusingSpecificParams> interpolateFusingParamsSet{
+ emptyFusingSpec
+};
+
+const std::vector<ov::AnyMap> filterAdditionalConfig = {
+ {ov::hint::inference_precision(ov::element::f32)},
+ {ov::hint::inference_precision(ov::element::f16)}
+};
+
+const std::vector<CPUSpecificParams> filterCPUInfoForDevice = {
+ CPUSpecificParams{{nchw, x, x, x}, {nchw}, {"acl"}, "acl"},
+ CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"acl"}, "acl"}
+};
+
+const std::vector<std::vector<size_t>> pads4D = {
+ {0, 0, 0, 0}
+};
+
+const std::vector<std::vector<int64_t>> defaultAxes4D = {
+ {0, 1, 2, 3}
+};
+
+const std::vector<ShapeParams> shapeParams4D_Smoke = {
+ ShapeParams{
+ ov::op::v11::Interpolate::ShapeCalcMode::SCALES,
+ InputShape{{}, {{1, 11, 4, 4}}},
+ ov::test::utils::InputLayerType::CONSTANT,
+ {{1.f, 1.f, 1.25f, 1.5f}},
+ defaultAxes4D.front()
+ },
+ ShapeParams{
+ ov::op::v11::Interpolate::ShapeCalcMode::SIZES,
+ InputShape{{}, {{1, 11, 4, 4}}},
+ ov::test::utils::InputLayerType::CONSTANT,
+ {{1, 11, 5, 6}},
+ defaultAxes4D.front()
+ }
+};
+
+const ShapeParams shapeParams4D_Scales = ShapeParams{
+ ov::op::v11::Interpolate::ShapeCalcMode::SCALES,
+ InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}, {1, 11, 4, 4}}},
+ ov::test::utils::InputLayerType::CONSTANT,
+ {{1.f, 1.f, 1.25f, 1.5f}},
+ defaultAxes4D.front()
+ };
+
+const ShapeParams shapeParams4D_Sizes = ShapeParams{
+ ov::op::v11::Interpolate::ShapeCalcMode::SIZES,
+ InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {1, 11, 5, 5}, {1, 11, 4, 4}}},
+ ov::test::utils::InputLayerType::CONSTANT,
+ {{1, 11, 5, 6}},
+ defaultAxes4D.front()
+ };
+
+const std::vector<ShapeParams> shapeParams4D_Full = { shapeParams4D_Scales, shapeParams4D_Sizes };
+
+INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
+ ::testing::Values(ov::op::v11::Interpolate::CoordinateTransformMode::ASYMMETRIC),
+ ::testing::ValuesIn(interpolateNearestModes),
+ ::testing::ValuesIn(antialias()),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(cubeCoefs())),
+ ::testing::ValuesIn(shapeParams4D_Smoke),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+const auto interpolateCasesNN_Full = ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
+ ::testing::Values(ov::op::v11::Interpolate::CoordinateTransformMode::ALIGN_CORNERS),
+ ::testing::Values(ov::op::v11::Interpolate::NearestMode::ROUND_PREFER_CEIL),
+ ::testing::ValuesIn(antialias()),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(cubeCoefs()));
+
+INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_Test, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ interpolateCasesNN_Full,
+ ::testing::ValuesIn(shapeParams4D_Full),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+const auto interpolateCasesLinearOnnx_Full = ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR_ONNX),
+ ::testing::ValuesIn(coordinateTransformModes_Full),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(cubeCoefs()));
+
+INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx_Layout_Test_Sizes, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ interpolateCasesLinearOnnx_Full,
+ ::testing::Values(shapeParams4D_Sizes),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+const auto interpolateCasesLinearOnnx_Scales = ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR_ONNX),
+ ::testing::Values(ov::op::v11::Interpolate::CoordinateTransformMode::ALIGN_CORNERS),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(cubeCoefs()));
+
+INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx_Layout_Test_Scales, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ interpolateCasesLinearOnnx_Scales,
+ ::testing::Values(shapeParams4D_Scales),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+const auto interpolateCasesLinear_Full = ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR),
+ ::testing::ValuesIn(coordinateTransformModes_Full),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(cubeCoefs()));
+
+INSTANTIATE_TEST_SUITE_P(InterpolateLinear_Layout_Test_sizes, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ interpolateCasesLinear_Full,
+ ::testing::Values(shapeParams4D_Sizes),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+const auto interpolateCasesLinear_Scales = ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR),
+ ::testing::Values(ov::op::v11::Interpolate::CoordinateTransformMode::ALIGN_CORNERS),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(pads4D),
+ ::testing::ValuesIn(cubeCoefs()));
+
+INSTANTIATE_TEST_SUITE_P(InterpolateLinear_Layout_Test_scales, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ interpolateCasesLinear_Scales,
+ ::testing::Values(shapeParams4D_Scales),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+// corner cases
+const std::vector<ShapeParams> shapeParams4D_corner = {
+ ShapeParams{
+ ov::op::v11::Interpolate::ShapeCalcMode::SCALES,
+ InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}},
+ ov::test::utils::InputLayerType::PARAMETER,
+ {{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}},
+ defaultAxes4D.front()
+ },
+ ShapeParams{
+ ov::op::v11::Interpolate::ShapeCalcMode::SIZES,
+ InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}},
+ ov::test::utils::InputLayerType::PARAMETER,
+ {{1, 11, 6, 7}, {1, 11, 8, 7}},
+ defaultAxes4D.front()
+ }
+};
+
+const auto interpolateCornerCases = ::testing::Combine(
+ ::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
+ ::testing::Values(ov::op::v11::Interpolate::CoordinateTransformMode::ASYMMETRIC),
+ ::testing::Values(ov::op::v11::Interpolate::NearestMode::SIMPLE),
+ ::testing::ValuesIn(antialias()),
+ ::testing::Values(std::vector<size_t>{0, 0, 0, 0}),
+ ::testing::Values(std::vector<size_t>{0, 0, 0, 0}),
+ ::testing::ValuesIn(cubeCoefs()));
+
+INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_corner_Layout_Test, InterpolateLayerCPUTest,
+ ::testing::Combine(
+ interpolateCornerCases,
+ ::testing::ValuesIn(shapeParams4D_corner),
+ ::testing::Values(ElementType::f32),
+ ::testing::ValuesIn(filterCPUInfoForDevice),
+ ::testing::ValuesIn(interpolateFusingParamsSet),
+ ::testing::ValuesIn(filterAdditionalConfig)),
+ InterpolateLayerCPUTest::getTestCaseName);
+
+} // namespace Interpolate
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/interpolate.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/interpolate.cpp
similarity index 71%
rename from src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/interpolate.cpp
rename to src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/interpolate.cpp
index 1dc0a3ec6b7..b129af76bde 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/interpolate.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/interpolate.cpp
@@ -2,278 +2,43 @@
// SPDX-License-Identifier: Apache-2.0
//
+#include "custom/single_layer_tests/classes/interpolate.hpp"
#include "common_test_utils/ov_tensor_utils.hpp"
#include "openvino/core/preprocess/pre_post_process.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
#include "utils/cpu_test_utils.hpp"
#include "utils/fusing_test_utils.hpp"
-#include "transformations/op_conversions/convert_interpolate11_downgrade.hpp"
-#include "openvino/pass/manager.hpp"
using namespace CPUTestUtils;
namespace ov {
namespace test {
+namespace Interpolate {
+namespace {
-using InterpolateSpecificParams =
- std::tuple<ov::op::v11::Interpolate::InterpolateMode, // InterpolateMode
- ov::op::v11::Interpolate::CoordinateTransformMode, // CoordinateTransformMode
- ov::op::v11::Interpolate::NearestMode, // NearestMode
- bool, // AntiAlias
- std::vector<size_t>, // PadBegin
- std::vector<size_t>, // PadEnd
- double>; // Cube coef
-
-using ShapeParams = std::tuple<ov::op::v11::Interpolate::ShapeCalcMode, // ShapeCalculationMode
- InputShape, // Input shapes
- // params describing input, choice of which depends on ShapeCalcMode
- ov::test::utils::InputLayerType, // input type
- std::vector<std::vector<float>>, // scales or sizes values
- std::vector<int64_t>>; // axes
-
-using InterpolateLayerCPUTestParamsSet = std::tuple<InterpolateSpecificParams,
- ShapeParams,
- ElementType,
- CPUSpecificParams,
- fusingSpecificParams,
- ov::AnyMap>;
-
-class InterpolateLayerCPUTest : public testing::WithParamInterface<InterpolateLayerCPUTestParamsSet>,
- virtual public SubgraphBaseTest, public CpuTestWithFusing {
-public:
- static std::string getTestCaseName(testing::TestParamInfo<InterpolateLayerCPUTestParamsSet> obj) {
- InterpolateSpecificParams specificParams;
- ShapeParams shapeParams;
- ElementType prec;
- CPUSpecificParams cpuParams;
- fusingSpecificParams fusingParams;
- ov::AnyMap additionalConfig;
- std::tie(specificParams, shapeParams, prec, cpuParams, fusingParams, additionalConfig) = obj.param;
-
- ov::op::v11::Interpolate::InterpolateMode mode;
- ov::op::v11::Interpolate::CoordinateTransformMode transfMode;
- ov::op::v11::Interpolate::NearestMode nearMode;
- bool antiAlias;
- std::vector<size_t> padBegin;
- std::vector<size_t> padEnd;
- double cubeCoef;
- std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
-
- ov::op::v11::Interpolate::ShapeCalcMode shapeCalcMode;
- InputShape inputShapes;
- ov::test::utils::InputLayerType shapeInputType;
- std::vector<std::vector<float>> shapeDataForInput;
- std::vector<int64_t> axes;
- std::tie(shapeCalcMode, inputShapes, shapeInputType, shapeDataForInput, axes) = shapeParams;
-
- using ov::test::utils::operator<<;
- std::ostringstream result;
- result << "ShapeCalcMode=" << shapeCalcMode << "_";
- result << "IS=";
- result << ov::test::utils::partialShape2str({inputShapes.first}) << "_";
- result << "TS=";
- for (const auto& shape : inputShapes.second) {
- result << ov::test::utils::vec2str(shape) << "_";
- }
- if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
- result << "Scales=";
- } else {
- result << "Sizes=";
- }
- for (const auto &data : shapeDataForInput) {
- result << ov::test::utils::vec2str(data) << "_";
- }
- result << shapeInputType << "_";
- result << "InterpolateMode=" << mode << "_";
- result << "CoordinateTransformMode=" << transfMode << "_";
- result << "NearestMode=" << nearMode << "_";
- result << "CubeCoef=" << cubeCoef << "_";
- result << "Antialias=" << antiAlias << "_";
- result << "PB=" << ov::test::utils::vec2str(padBegin) << "_";
- result << "PE=" << ov::test::utils::vec2str(padEnd) << "_";
- result << "Axes=" << ov::test::utils::vec2str(axes) << "_";
- result << "PRC=" << prec << "_";
-
- result << CPUTestsBase::getTestCaseName(cpuParams);
- result << CpuTestWithFusing::getTestCaseName(fusingParams);
-
- if (!additionalConfig.empty()) {
- result << "_PluginConf";
- for (auto& item : additionalConfig) {
- result << "_" << item.first << "=" << item.second.as<std::string>();
- }
- }
-
- return result.str();
- }
-
- void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override {
- inputs.clear();
- const auto& funcInputs = function->inputs();
- for (size_t i = 0; i < funcInputs.size(); ++i) {
- const auto& funcInput = funcInputs[i];
- ov::Tensor tensor;
-
- if (i == 1) {
- if (shapeCalcMode == ov::op::v4::Interpolate::ShapeCalcMode::SIZES) {
- tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], sizes[inferRequestNum].data());
- } else {
- tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], scales[inferRequestNum].data());
- }
- } else {
- ov::test::utils::InputGenerateData in_data;
- in_data.start_from = 0;
- in_data.range = 2560;
- in_data.resolution = 256;
- tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], in_data);
- }
-
- inputs.insert({funcInput.get_node_shared_ptr(), tensor});
- }
- inferRequestNum++;
- }
-
- void configure_model() override {
- ov::preprocess::PrePostProcessor p(function);
- {
- auto& params = function->get_parameters();
- for (size_t i = 0; i < params.size(); i++) {
- if (i > 0) {
- continue;
- }
- if (inType != ov::element::Type_t::undefined) {
- p.input(i).tensor().set_element_type(inType);
- }
- }
- }
- {
- auto results = function->get_results();
- for (size_t i = 0; i < results.size(); i++) {
- if (outType != ov::element::Type_t::undefined) {
- p.output(i).tensor().set_element_type(outType);
- }
- }
- }
- function = p.build();
+const std::vector<ov::AnyMap> filterAdditionalConfig() {
+ if (ov::with_cpu_x86_avx512f()) {
+ return {{{ov::hint::inference_precision(ov::element::f32)}},
+ {{ov::hint::inference_precision(ov::element::bf16)}}};
+ } else {
+ return {// default config as an stub for target without avx512, otherwise all tests with BF16 in its name are
+ // skipped
+ {}};
}
+}
-protected:
- std::vector<std::vector<float>> scales;
- std::vector<std::vector<int32_t>> sizes;
- ov::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
- size_t inferRequestNum = 0;
-
- void SetUp() override {
- targetDevice = ov::test::utils::DEVICE_CPU;
-
- InterpolateSpecificParams specificParams;
- ShapeParams shapeParams;
- ElementType ngPrc;
- CPUSpecificParams cpuParams;
- fusingSpecificParams fusingParams;
- ov::AnyMap additionalConfig;
- std::tie(specificParams, shapeParams, ngPrc, cpuParams, fusingParams, additionalConfig) = this->GetParam();
-
- std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
- std::tie(postOpMgrPtr, fusedOps) = fusingParams;
- configuration.insert(additionalConfig.begin(), additionalConfig.end());
-
- ov::op::v11::Interpolate::InterpolateMode mode;
- ov::op::v11::Interpolate::CoordinateTransformMode transfMode;
- ov::op::v11::Interpolate::NearestMode nearMode;
- bool antiAlias;
- std::vector<size_t> padBegin;
- std::vector<size_t> padEnd;
- double cubeCoef;
- std::tie(mode, transfMode, nearMode, antiAlias, padBegin, padEnd, cubeCoef) = specificParams;
-
- InputShape dataShape;
- ov::test::utils::InputLayerType shapeInputType;
- std::vector<std::vector<float>> shapeDataForInput;
- std::vector<int64_t> axes;
- std::tie(shapeCalcMode, dataShape, shapeInputType, shapeDataForInput, axes) = shapeParams;
-
- if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
- scales = shapeDataForInput;
- } else {
- sizes.resize(shapeDataForInput.size());
- for (size_t i = 0; i < shapeDataForInput.size(); i++) {
- for (size_t j = 0; j < shapeDataForInput[i].size(); j++) {
- sizes[i].push_back(shapeDataForInput[i][j]);
- }
- }
- }
-
- std::vector<InputShape> inputShapes;
- inputShapes.push_back(dataShape);
- if (shapeInputType == ov::test::utils::InputLayerType::PARAMETER) {
- inputShapes.push_back(InputShape({static_cast<int64_t>(axes.size())}, std::vector<ov::Shape>(dataShape.second.size(), {axes.size()})));
- }
-
- auto it = additionalConfig.find(ov::hint::inference_precision.name());
- if (it != additionalConfig.end() && it->second.as<ov::element::Type>() == ov::element::bf16) {
- inType = outType = ngPrc = ElementType::bf16;
- rel_threshold = 1e-2f;
- } else {
- inType = outType = ngPrc;
- }
-
- init_input_shapes(inputShapes);
-
- ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(ngPrc, inputDynamicShapes.front())};
- std::shared_ptr<ov::Node> sizesInput, scalesInput;
- if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
- if (shapeInputType == ov::test::utils::InputLayerType::PARAMETER) {
- auto paramNode = std::make_shared<ov::op::v0::Parameter>(ElementType::f32, ov::Shape{scales.front().size()});
- params.push_back(paramNode);
- scalesInput = paramNode;
- } else {
- scalesInput = std::make_shared<ov::op::v0::Constant>(ElementType::f32, ov::Shape{scales.front().size()}, scales.front());
- }
- } else {
- if (shapeInputType == ov::test::utils::InputLayerType::PARAMETER) {
- auto paramNode = std::make_shared<ov::op::v0::Parameter>(ElementType::i32, ov::Shape{sizes.front().size()});
- params.push_back(paramNode);
- sizesInput = paramNode;
- } else {
- sizesInput = std::make_shared<ov::op::v0::Constant>(ElementType::i32, ov::Shape{sizes.front().size()}, sizes.front());
- }
- }
- auto axesInput = std::make_shared<ov::op::v0::Constant>(ElementType::i64, ov::Shape{axes.size()}, axes);
-
- for (size_t i = 0; i < params.size(); i++) {
- params[i]->set_friendly_name(std::string("param_") + std::to_string(i));
- }
-
- ov::op::v11::Interpolate::InterpolateAttrs interpAttr{mode, shapeCalcMode, padBegin, padEnd, transfMode, nearMode,
- antiAlias, cubeCoef};
-
- std::shared_ptr<ov::op::v11::Interpolate> interp = nullptr;
- if (shapeCalcMode == ov::op::v11::Interpolate::ShapeCalcMode::SCALES) {
- interp = std::make_shared<ov::op::v11::Interpolate>(params[0], scalesInput, axesInput, interpAttr);
- } else {
- interp = std::make_shared<ov::op::v11::Interpolate>(params[0], sizesInput, axesInput, interpAttr);
- }
-
- function = makeNgraphFunction(ngPrc, params, interp, "InterpolateCPU");
-
- ov::pass::Manager m;
- m.register_pass<ov::pass::ConvertInterpolate11ToInterpolate4>();
- m.run_passes(function);
-
- if (selectedType.empty()) {
- selectedType = getPrimitiveType();
- }
- selectedType = makeSelectedTypeStr(selectedType, ngPrc);
+const std::vector<CPUSpecificParams> filterCPUInfoForDevice3D() {
+ if (ov::with_cpu_x86_avx2()) {
+ return { CPUSpecificParams{{ncw, x, x, x}, {ncw}, {"jit_avx2"}, "jit_avx2"} };
+ } else {
+ return { CPUSpecificParams{{ncw, x, x, x}, {ncw}, {"ref"}, "ref"} };
}
-};
+}
-TEST_P(InterpolateLayerCPUTest, CompareWithRefs) {
- run();
- CheckPluginRelatedResults(compiledModel, "Interpolate");
+const std::vector<ov::AnyMap> filterAdditionalConfig3D() {
+ return { {} };
}
-namespace {
const std::vector<ov::op::v11::Interpolate::CoordinateTransformMode> coordinateTransformModes_Smoke = {
ov::op::v11::Interpolate::CoordinateTransformMode::HALF_PIXEL,
ov::op::v11::Interpolate::CoordinateTransformMode::ASYMMETRIC,
@@ -301,54 +66,12 @@ const std::vector<ov::op::v11::Interpolate::NearestMode> nearestModes_Full = {
ov::op::v11::Interpolate::NearestMode::ROUND_PREFER_CEIL,
};
-const std::vector<ov::op::v11::Interpolate::NearestMode> defNearestModes = {
- ov::op::v11::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
-};
-
-const std::vector<bool> antialias = {
- false,
-};
-
-const std::vector<double> cubeCoefs = {
- -0.75f,
-};
-
const std::vector<fusingSpecificParams> interpolateFusingParamsSet{
emptyFusingSpec,
-#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
fusingSwish,
- fusingFakeQuantizePerTensorRelu,
-#endif
+ fusingFakeQuantizePerTensorRelu
};
-std::vector<ov::AnyMap> filterAdditionalConfig() {
- if (ov::with_cpu_x86_avx512f()) {
- return {{{ov::hint::inference_precision(ov::element::f32)}},
- {{ov::hint::inference_precision(ov::element::bf16)}}};
- } else {
- return {// default config as an stub for target without avx512, otherwise all tests with BF16 in its name are
- // skipped
- {}};
- }
-}
-
-// 3D
-std::vector<CPUSpecificParams> filterCPUInfoForDevice3D() {
- std::vector<CPUSpecificParams> resCPUParams;
- if (ov::with_cpu_x86_avx2()) {
- resCPUParams.push_back(CPUSpecificParams{{ncw, x, x, x}, {ncw}, {"jit_avx2"}, "jit_avx2"});
- } else {
- resCPUParams.push_back(CPUSpecificParams{{ncw, x, x, x}, {ncw}, {"ref"}, "ref"});
- }
- return resCPUParams;
-}
-
-std::vector<ov::AnyMap> filterAdditionalConfig3D() {
- return {
- {}
- };
-}
-
const std::vector<std::vector<size_t>> pads3D_smoke = {
{0, 0, 0},
};
@@ -382,10 +105,10 @@ const auto interpolateCasesNN_Smoke_3D = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::ValuesIn(coordinateTransformModes_Smoke),
::testing::ValuesIn(nearestModes_Smoke),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads3D_smoke),
::testing::ValuesIn(pads3D_smoke),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test_3D, InterpolateLayerCPUTest,
::testing::Combine(
interpolateCasesNN_Smoke_3D,
@@ -400,10 +123,10 @@ const auto interpolateCasesNN_Full_3D = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::ValuesIn(coordinateTransformModes_Full),
::testing::ValuesIn(nearestModes_Full),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads3D_full),
::testing::ValuesIn(pads3D_full),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_Test_3D, InterpolateLayerCPUTest,
::testing::Combine(
interpolateCasesNN_Full_3D,
@@ -414,7 +137,6 @@ INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_Test_3D, InterpolateLayerCPUTest,
::testing::ValuesIn(filterAdditionalConfig3D())),
InterpolateLayerCPUTest::getTestCaseName);
-#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
const std::vector<fusingSpecificParams> interpolateFusingParamsSet3D_fixed_C() {
std::vector<fusingSpecificParams> fuseParams;
if (ov::with_cpu_x86_avx2()) {
@@ -461,25 +183,24 @@ INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_PerChannelFuse3D_Test, Interpolate
::testing::ValuesIn(interpolateFusingParamsSet3D_fixed_C()),
::testing::ValuesIn(filterAdditionalConfig3D())),
InterpolateLayerCPUTest::getTestCaseName);
-#endif
const auto interpolateCasesLinear3D_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR),
::testing::ValuesIn(coordinateTransformModes_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads3D_smoke),
::testing::ValuesIn(pads3D_smoke),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesLinear3D_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR),
::testing::ValuesIn(coordinateTransformModes_Full),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads3D_full),
::testing::ValuesIn(pads3D_full),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinear_Layout3D_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -504,20 +225,20 @@ INSTANTIATE_TEST_SUITE_P(InterpolateLinear_Layout3D_Test, InterpolateLayerCPUTes
const auto interpolateCasesCubic3D_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::CUBIC),
::testing::ValuesIn(coordinateTransformModes_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads3D_smoke),
::testing::ValuesIn(pads3D_smoke),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesCubic3D_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::CUBIC),
::testing::ValuesIn(coordinateTransformModes_Full),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads3D_full),
::testing::ValuesIn(pads3D_full),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout3D_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -619,19 +340,19 @@ const auto interpolateCasesNN_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::ValuesIn(coordinateTransformModes_Smoke),
::testing::ValuesIn(nearestModes_Smoke),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesNN_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::ValuesIn(coordinateTransformModes_Full),
::testing::ValuesIn(nearestModes_Full),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -653,7 +374,6 @@ INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_Test, InterpolateLayerCPUTest,
::testing::ValuesIn(filterAdditionalConfig())),
InterpolateLayerCPUTest::getTestCaseName);
-#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
const std::vector<fusingSpecificParams> interpolateFusingParamsSet_fixed_C{
fusingFakeQuantizePerChannelRelu,
fusingMultiplyPerChannel,
@@ -695,25 +415,24 @@ INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLa
::testing::ValuesIn(interpolateFusingParamsSet_fixed_C),
::testing::ValuesIn(filterAdditionalConfig())),
InterpolateLayerCPUTest::getTestCaseName);
-#endif
const auto interpolateCasesLinearOnnx_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR_ONNX),
::testing::ValuesIn(coordinateTransformModes_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesLinearOnnx_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR_ONNX),
::testing::ValuesIn(coordinateTransformModes_Full),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -738,20 +457,20 @@ INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx_Layout_Test, InterpolateLayerCPUT
const auto interpolateCasesLinear_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR),
::testing::ValuesIn(coordinateTransformModes_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesLinear_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR),
::testing::ValuesIn(coordinateTransformModes_Full),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinear_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -776,20 +495,20 @@ INSTANTIATE_TEST_SUITE_P(InterpolateLinear_Layout_Test, InterpolateLayerCPUTest,
const auto interpolateCasesCubic_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::CUBIC),
::testing::ValuesIn(coordinateTransformModes_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesCubic_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::CUBIC),
::testing::ValuesIn(coordinateTransformModes_Full),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -889,19 +608,19 @@ const std::vector<ShapeParams> shapeParams5D_Full = {
const auto interpolateCasesLinearOnnx5D_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR_ONNX),
::testing::ValuesIn(coordinateTransformModes_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads5D),
::testing::ValuesIn(pads5D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesLinearOnnx5D_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::LINEAR_ONNX),
::testing::ValuesIn(coordinateTransformModes_Full),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads5D),
::testing::ValuesIn(pads5D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -927,19 +646,19 @@ const auto interpolateCasesNN5D_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::ValuesIn(coordinateTransformModes_Smoke),
::testing::ValuesIn(nearestModes_Smoke),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads5D),
::testing::ValuesIn(pads5D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
const auto interpolateCasesNN5D_Full = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::ValuesIn(coordinateTransformModes_Full),
::testing::ValuesIn(nearestModes_Full),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads5D),
::testing::ValuesIn(pads5D),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN5D_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -983,10 +702,10 @@ const auto interpolateCornerCases = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::NEAREST),
::testing::Values(ov::op::v11::Interpolate::CoordinateTransformMode::ASYMMETRIC),
::testing::Values(ov::op::v11::Interpolate::NearestMode::SIMPLE),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(antialias()),
::testing::Values(std::vector<size_t>{0, 0, 0, 0}),
::testing::Values(std::vector<size_t>{0, 0, 0, 0}),
- ::testing::ValuesIn(cubeCoefs));
+ ::testing::ValuesIn(cubeCoefs()));
INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_corner_Layout_Test, InterpolateLayerCPUTest,
::testing::Combine(
@@ -1101,8 +820,8 @@ std::vector<ov::AnyMap> filterPillowAdditionalConfig() {
const auto interpolateCasesBilinearPillow_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::BILINEAR_PILLOW),
::testing::ValuesIn(coordinateTransformModesPillow_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(cubeCoefsPillow));
@@ -1110,8 +829,8 @@ const auto interpolateCasesBilinearPillow_Smoke = ::testing::Combine(
const auto interpolateCasesBicubicPillow_Smoke = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::BICUBIC_PILLOW),
::testing::ValuesIn(coordinateTransformModesPillow_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(pads4D),
::testing::ValuesIn(cubeCoefsPillow));
@@ -1191,8 +910,8 @@ std::vector<CPUSpecificParams> filterCPUInfoForDevice_pillow_nchw_as_nhwc() {
const auto interpolateCasesBilinearPillow_Smoke_nchw_as_nhwc = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::BILINEAR_PILLOW),
::testing::ValuesIn(coordinateTransformModesPillow_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D_nchw_as_nhwc),
::testing::ValuesIn(pads4D_nchw_as_nhwc),
::testing::ValuesIn(cubeCoefsPillow));
@@ -1210,8 +929,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_InterpolateBilinearPillow_LayoutAlign_Test, Inter
const auto interpolateCasesBicubicPillow_Smoke_nchw_as_nhwc = ::testing::Combine(
::testing::Values(ov::op::v11::Interpolate::InterpolateMode::BICUBIC_PILLOW),
::testing::ValuesIn(coordinateTransformModesPillow_Smoke),
- ::testing::ValuesIn(defNearestModes),
- ::testing::ValuesIn(antialias),
+ ::testing::ValuesIn(defNearestModes()),
+ ::testing::ValuesIn(antialias()),
::testing::ValuesIn(pads4D_nchw_as_nhwc),
::testing::ValuesIn(pads4D_nchw_as_nhwc),
::testing::ValuesIn(cubeCoefsPillow));
@@ -1227,5 +946,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_InterpolateBicubicPillow_LayoutAlign_Test, Interp
InterpolateLayerCPUTest::getTestCaseName);
} // namespace
+} // namespace Interpolate
} // namespace test
} // namespace ov