* [CPU][Tests] Decreased number of test cases for Interpolate, Reduce and Pad operations * [CPU][Tests] Reduced number of DeformableConvolution smoke test cases * Fixed review comments
787 lines
35 KiB
C++
787 lines
35 KiB
C++
// Copyright (C) 2018-2021 Intel Corporation
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
#include "shared_test_classes/base/ov_subgraph.hpp"
|
|
#include "ngraph_functions/builders.hpp"
|
|
#include "test_utils/cpu_test_utils.hpp"
|
|
#include "test_utils/fusing_test_utils.hpp"
|
|
#include "functional_test_utils/ov_tensor_utils.hpp"
|
|
#include "openvino/core/preprocess/pre_post_process.hpp"
|
|
|
|
using namespace ov::test;
|
|
using namespace CPUTestUtils;
|
|
using ngraph::helpers::operator<<;
|
|
|
|
namespace CPULayerTestsDefinitions {
|
|
|
|
using InterpolateSpecificParams = std::tuple<ngraph::op::v4::Interpolate::InterpolateMode, // InterpolateMode
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode, // CoordinateTransformMode
|
|
ngraph::op::v4::Interpolate::NearestMode, // NearestMode
|
|
bool, // AntiAlias
|
|
std::vector<size_t>, // PadBegin
|
|
std::vector<size_t>, // PadEnd
|
|
double>; // Cube coef
|
|
|
|
using ShapeParams = std::tuple<ngraph::op::v4::Interpolate::ShapeCalcMode, // ShapeCalculationMode
|
|
InputShape, // Input shapes
|
|
// params describing input, choice of which depends on ShapeCalcMode
|
|
ngraph::helpers::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,
|
|
std::map<std::string, std::string>>;
|
|
|
|
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;
|
|
std::map<std::string, std::string> additionalConfig;
|
|
std::tie(specificParams, shapeParams, prec, cpuParams, fusingParams, additionalConfig) = obj.param;
|
|
|
|
ngraph::op::v4::Interpolate::InterpolateMode mode;
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode;
|
|
ngraph::op::v4::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;
|
|
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
|
InputShape inputShapes;
|
|
ngraph::helpers::InputLayerType shapeInputType;
|
|
std::vector<std::vector<float>> shapeDataForInput;
|
|
std::vector<int64_t> axes;
|
|
std::tie(shapeCalcMode, inputShapes, shapeInputType, shapeDataForInput, axes) = shapeParams;
|
|
|
|
std::ostringstream result;
|
|
result << "ShapeCalcMode=" << shapeCalcMode << "_";
|
|
result << "IS=";
|
|
result << CommonTestUtils::partialShape2str({inputShapes.first}) << "_";
|
|
result << "TS=";
|
|
for (const auto& shape : inputShapes.second) {
|
|
result << CommonTestUtils::vec2str(shape) << "_";
|
|
}
|
|
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
|
result << "Scales=";
|
|
} else {
|
|
result << "Sizes=";
|
|
}
|
|
for (const auto &data : shapeDataForInput) {
|
|
result << CommonTestUtils::vec2str(data) << "_";
|
|
}
|
|
result << shapeInputType << "_";
|
|
result << "InterpolateMode=" << mode << "_";
|
|
result << "CoordinateTransformMode=" << transfMode << "_";
|
|
result << "NearestMode=" << nearMode << "_";
|
|
result << "CubeCoef=" << cubeCoef << "_";
|
|
result << "Antialias=" << antiAlias << "_";
|
|
result << "PB=" << CommonTestUtils::vec2str(padBegin) << "_";
|
|
result << "PE=" << CommonTestUtils::vec2str(padEnd) << "_";
|
|
result << "Axes=" << CommonTestUtils::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;
|
|
}
|
|
}
|
|
|
|
return result.str();
|
|
}
|
|
|
|
void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) override {
|
|
inputs.clear();
|
|
const auto& funcInputs = function->inputs();
|
|
for (int i = 0; i < funcInputs.size(); ++i) {
|
|
const auto& funcInput = funcInputs[i];
|
|
ov::runtime::Tensor tensor;
|
|
|
|
if (i == 1) {
|
|
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES) {
|
|
tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], sizes[inferRequestNum].data());
|
|
} else {
|
|
tensor = ov::runtime::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i], scales[inferRequestNum].data());
|
|
}
|
|
} else {
|
|
tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 2560, 0, 256);
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
protected:
|
|
std::vector<std::vector<float>> scales;
|
|
std::vector<std::vector<int32_t>> sizes;
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode shapeCalcMode;
|
|
size_t inferRequestNum = 0;
|
|
|
|
void SetUp() override {
|
|
targetDevice = CommonTestUtils::DEVICE_CPU;
|
|
|
|
InterpolateSpecificParams specificParams;
|
|
ShapeParams shapeParams;
|
|
ElementType ngPrc;
|
|
CPUSpecificParams cpuParams;
|
|
fusingSpecificParams fusingParams;
|
|
std::map<std::string, std::string> 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());
|
|
|
|
ngraph::op::v4::Interpolate::InterpolateMode mode;
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode transfMode;
|
|
ngraph::op::v4::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;
|
|
ngraph::helpers::InputLayerType shapeInputType;
|
|
std::vector<std::vector<float>> shapeDataForInput;
|
|
std::vector<int64_t> axes;
|
|
std::tie(shapeCalcMode, dataShape, shapeInputType, shapeDataForInput, axes) = shapeParams;
|
|
|
|
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
|
scales = shapeDataForInput;
|
|
sizes.resize(scales.size(), std::vector<int32_t>(scales.front().size(), 0));
|
|
} 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]);
|
|
}
|
|
}
|
|
scales.resize(sizes.size(), std::vector<float>(sizes.front().size(), 0));
|
|
}
|
|
|
|
std::vector<InputShape> inputShapes;
|
|
inputShapes.push_back(dataShape);
|
|
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
|
inputShapes.push_back(InputShape({static_cast<int64_t>(axes.size())}, std::vector<ov::Shape>(dataShape.second.size(), {axes.size()})));
|
|
}
|
|
|
|
if (additionalConfig[InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16] == InferenceEngine::PluginConfigParams::YES) {
|
|
inType = outType = ngPrc = ElementType::bf16;
|
|
rel_threshold = 1e-2f;
|
|
} else {
|
|
inType = outType = ngPrc;
|
|
}
|
|
|
|
init_input_shapes(inputShapes);
|
|
|
|
auto params = ngraph::builder::makeDynamicParams(ngPrc, {inputDynamicShapes.front()});
|
|
|
|
std::shared_ptr<ov::Node> sizesInput, scalesInput;
|
|
if (shapeCalcMode == ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES) {
|
|
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
|
auto paramNode = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()});
|
|
params.push_back(paramNode);
|
|
scalesInput = paramNode;
|
|
} else {
|
|
scalesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front());
|
|
}
|
|
sizesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front());
|
|
} else {
|
|
if (shapeInputType == ngraph::helpers::InputLayerType::PARAMETER) {
|
|
auto paramNode = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()});
|
|
params.push_back(paramNode);
|
|
sizesInput = paramNode;
|
|
} else {
|
|
sizesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::i32, ov::Shape{sizes.front().size()}, sizes.front());
|
|
}
|
|
scalesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::f32, ov::Shape{scales.front().size()}, scales.front());
|
|
}
|
|
auto axesInput = std::make_shared<ngraph::opset3::Constant>(ngraph::element::Type_t::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));
|
|
}
|
|
|
|
ngraph::op::v4::Interpolate::InterpolateAttrs interpAttr{mode, shapeCalcMode, padBegin, padEnd, transfMode, nearMode,
|
|
antiAlias, cubeCoef};
|
|
|
|
auto interpolate = std::make_shared<ngraph::op::v4::Interpolate>(params[0],
|
|
sizesInput,
|
|
scalesInput,
|
|
axesInput,
|
|
interpAttr);
|
|
|
|
function = makeNgraphFunction(ngPrc, params, interpolate, "InterpolateCPU");
|
|
|
|
if (selectedType.empty()) {
|
|
selectedType = getPrimitiveType();
|
|
}
|
|
selectedType = makeSelectedTypeStr(selectedType, ngPrc);
|
|
}
|
|
};
|
|
|
|
TEST_P(InterpolateLayerCPUTest, CompareWithRefs) {
|
|
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
|
|
|
run();
|
|
CheckPluginRelatedResults(executableNetwork, "Interpolate");
|
|
}
|
|
|
|
namespace {
|
|
|
|
/* CPU PARAMS */
|
|
std::vector<CPUSpecificParams> filterCPUInfoForDevice() {
|
|
std::vector<CPUSpecificParams> resCPUParams;
|
|
if (InferenceEngine::with_cpu_x86_avx512f()) {
|
|
resCPUParams.push_back(CPUSpecificParams{{nChw16c, x, x, x}, {nChw16c}, {"jit_avx512"}, "jit_avx512"});
|
|
resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_avx512"}, "jit_avx512"});
|
|
} else if (InferenceEngine::with_cpu_x86_avx2()) {
|
|
resCPUParams.push_back(CPUSpecificParams{{nChw8c, x, x, x}, {nChw8c}, {"jit_avx2"}, "jit_avx2"});
|
|
resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_avx2"}, "jit_avx2"});
|
|
resCPUParams.push_back(CPUSpecificParams{{nchw, x, x, x}, {nchw}, {"jit_avx2"}, "jit_avx2"});
|
|
} else if (InferenceEngine::with_cpu_x86_sse42()) {
|
|
resCPUParams.push_back(CPUSpecificParams{{nChw8c, x, x, x}, {nChw8c}, {"jit_sse42"}, "jit_sse42"});
|
|
resCPUParams.push_back(CPUSpecificParams{{nhwc, x, x, x}, {nhwc}, {"jit_sse42"}, "jit_sse42"});
|
|
} else {
|
|
resCPUParams.push_back(CPUSpecificParams{{nchw, x, x, x}, {nchw}, {"ref"}, "ref"});
|
|
}
|
|
return resCPUParams;
|
|
}
|
|
/* ========== */
|
|
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModes_Smoke = {
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::HALF_PIXEL,
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC,
|
|
};
|
|
|
|
const std::vector<ngraph::op::v4::Interpolate::CoordinateTransformMode> coordinateTransformModes_Full = {
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::TF_HALF_PIXEL_FOR_NN,
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::PYTORCH_HALF_PIXEL,
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::HALF_PIXEL,
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC,
|
|
ngraph::op::v4::Interpolate::CoordinateTransformMode::ALIGN_CORNERS,
|
|
};
|
|
|
|
const std::vector<ngraph::op::v4::Interpolate::NearestMode> nearestModes_Smoke = {
|
|
ngraph::op::v4::Interpolate::NearestMode::SIMPLE,
|
|
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
|
ngraph::op::v4::Interpolate::NearestMode::FLOOR,
|
|
};
|
|
|
|
const std::vector<ngraph::op::v4::Interpolate::NearestMode> nearestModes_Full = {
|
|
ngraph::op::v4::Interpolate::NearestMode::SIMPLE,
|
|
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
|
ngraph::op::v4::Interpolate::NearestMode::FLOOR,
|
|
ngraph::op::v4::Interpolate::NearestMode::CEIL,
|
|
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_CEIL,
|
|
};
|
|
|
|
const std::vector<ngraph::op::v4::Interpolate::NearestMode> defNearestModes = {
|
|
ngraph::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR,
|
|
};
|
|
|
|
const std::vector<bool> antialias = {
|
|
false,
|
|
};
|
|
|
|
const std::vector<double> cubeCoefs = {
|
|
-0.75f,
|
|
};
|
|
|
|
const std::vector<fusingSpecificParams> interpolateFusingParamsSet{
|
|
emptyFusingSpec,
|
|
fusingSwish,
|
|
fusingFakeQuantizePerTensorRelu,
|
|
};
|
|
|
|
std::vector<std::map<std::string, std::string>> filterAdditionalConfig() {
|
|
if (InferenceEngine::with_cpu_x86_avx512f()) {
|
|
return {
|
|
{{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::NO}},
|
|
{{InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16, InferenceEngine::PluginConfigParams::YES}}
|
|
};
|
|
} else {
|
|
return {
|
|
// default config as an stub for target without avx512, otherwise all tests with BF16 in its name are skipped
|
|
{{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO}}
|
|
};
|
|
}
|
|
}
|
|
|
|
const std::vector<std::vector<size_t>> pads4D = {
|
|
{0, 0, 0, 0},
|
|
{0, 0, 1, 1},
|
|
};
|
|
|
|
const std::vector<std::vector<int64_t>> defaultAxes4D = {
|
|
{0, 1, 2, 3}
|
|
};
|
|
|
|
const std::vector<ShapeParams> shapeParams4D_Smoke = {
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{}, {{1, 11, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1.f, 1.f, 1.25f, 1.5f}},
|
|
defaultAxes4D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{}, {{1, 11, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1, 11, 5, 6}},
|
|
defaultAxes4D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}},
|
|
ngraph::helpers::InputLayerType::PARAMETER,
|
|
{{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}},
|
|
defaultAxes4D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}},
|
|
ngraph::helpers::InputLayerType::PARAMETER,
|
|
{{1, 11, 6, 7}, {2, 7, 8, 7}},
|
|
defaultAxes4D.front()
|
|
}
|
|
};
|
|
|
|
const std::vector<ShapeParams> shapeParams4D_Full = {
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {2, 7, 6, 5}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1.f, 1.f, 1.25f, 1.5f}},
|
|
defaultAxes4D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{-1, {2, 20}, -1, -1}, {{1, 11, 4, 4}, {1, 11, 5, 5}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1, 11, 5, 6}},
|
|
defaultAxes4D.front()
|
|
}
|
|
};
|
|
|
|
const auto interpolateCasesNN_Smoke = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
|
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
|
::testing::ValuesIn(nearestModes_Smoke),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
const auto interpolateCasesNN_Full = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
|
::testing::ValuesIn(coordinateTransformModes_Full),
|
|
::testing::ValuesIn(nearestModes_Full),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesNN_Smoke,
|
|
::testing::ValuesIn(shapeParams4D_Smoke),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
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 std::vector<ShapeParams> shapeParams4D_fixed_C = {
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{}, {{1, 11, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1.f, 1.f, 1.25f, 1.5f}},
|
|
defaultAxes4D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{-1, 16, -1, -1}, {{1, 16, 4, 4}, {1, 16, 6, 5}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1, 16, 6, 7}},
|
|
defaultAxes4D.front()
|
|
}
|
|
};
|
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesNN_Smoke,
|
|
::testing::ValuesIn(shapeParams4D_fixed_C),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::Values(fusingFakeQuantizePerChannelRelu),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
INSTANTIATE_TEST_SUITE_P(InterpolateNN_Layout_PerChannelFuse_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesNN_Full,
|
|
::testing::ValuesIn(shapeParams4D_fixed_C),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::Values(fusingFakeQuantizePerChannelRelu),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
const auto interpolateCasesLinearOnnx_Smoke = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
|
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
|
::testing::ValuesIn(defNearestModes),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
const auto interpolateCasesLinearOnnx_Full = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::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(smoke_InterpolateLinearOnnx_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesLinearOnnx_Smoke,
|
|
::testing::ValuesIn(shapeParams4D_Smoke),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesLinearOnnx_Full,
|
|
::testing::ValuesIn(shapeParams4D_Full),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
const auto interpolateCasesLinear_Smoke = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear),
|
|
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
|
::testing::ValuesIn(defNearestModes),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
const auto interpolateCasesLinear_Full = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::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(smoke_InterpolateLinear_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesLinear_Smoke,
|
|
::testing::ValuesIn(shapeParams4D_Smoke),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
INSTANTIATE_TEST_SUITE_P(InterpolateLinear_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesLinear_Full,
|
|
::testing::ValuesIn(shapeParams4D_Full),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
const auto interpolateCasesCubic_Smoke = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic),
|
|
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
|
::testing::ValuesIn(defNearestModes),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
const auto interpolateCasesCubic_Full = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::cubic),
|
|
::testing::ValuesIn(coordinateTransformModes_Full),
|
|
::testing::ValuesIn(defNearestModes),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(pads4D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateCubic_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesCubic_Smoke,
|
|
::testing::ValuesIn(shapeParams4D_Smoke),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
INSTANTIATE_TEST_SUITE_P(InterpolateCubic_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesCubic_Full,
|
|
::testing::ValuesIn(shapeParams4D_Full),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
////////////////////////5D/////////////////////////////
|
|
std::vector<CPUSpecificParams> filterCPUInfoForDevice5D() {
|
|
std::vector<CPUSpecificParams> resCPUParams;
|
|
if (InferenceEngine::with_cpu_x86_avx512f()) {
|
|
resCPUParams.push_back(CPUSpecificParams{{nCdhw16c, x, x, x}, {nCdhw16c}, {"jit_avx512"}, "jit_avx512"});
|
|
resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_avx512"}, "jit_avx512"});
|
|
} else if (InferenceEngine::with_cpu_x86_avx2()) {
|
|
resCPUParams.push_back(CPUSpecificParams{{nCdhw8c, x, x, x}, {nCdhw8c}, {"jit_avx2"}, "jit_avx2"});
|
|
resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_avx2"}, "jit_avx2"});
|
|
resCPUParams.push_back(CPUSpecificParams{{ncdhw, x, x, x}, {ncdhw}, {"jit_avx2"}, "jit_avx2"});
|
|
} else if (InferenceEngine::with_cpu_x86_sse42()) {
|
|
resCPUParams.push_back(CPUSpecificParams{{nCdhw8c, x, x, x}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"});
|
|
resCPUParams.push_back(CPUSpecificParams{{ndhwc, x, x, x}, {ndhwc}, {"jit_sse42"}, "jit_sse42"});
|
|
} else {
|
|
resCPUParams.push_back(CPUSpecificParams{{ncdhw, x, x, x}, {ncdhw}, {"ref"}, "ref"});
|
|
}
|
|
return resCPUParams;
|
|
}
|
|
|
|
const std::vector<std::vector<size_t>> pads5D = {
|
|
{0, 0, 0, 0, 0}
|
|
};
|
|
|
|
const std::vector<std::vector<int64_t>> defaultAxes5D = {
|
|
{0, 1, 2, 3, 4}
|
|
};
|
|
|
|
const std::vector<ShapeParams> shapeParams5D_Smoke = {
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{}, {{1, 11, 4, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}},
|
|
defaultAxes5D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{}, {{1, 11, 4, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1, 11, 5, 6, 2}},
|
|
defaultAxes5D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}},
|
|
ngraph::helpers::InputLayerType::PARAMETER,
|
|
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}, {1.f, 1.f, 1.25f, 1.25f, 1.25f}},
|
|
defaultAxes5D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}},
|
|
ngraph::helpers::InputLayerType::PARAMETER,
|
|
{{1, 11, 6, 7, 2}, {2, 7, 8, 7, 4}},
|
|
defaultAxes5D.front()
|
|
},
|
|
};
|
|
|
|
const std::vector<ShapeParams> shapeParams5D_Full = {
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {2, 7, 6, 5, 8}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1.f, 1.f, 1.25f, 1.5f, 0.5f}},
|
|
defaultAxes5D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{-1, {2, 20}, -1, -1, -1}, {{1, 11, 4, 4, 4}, {1, 11, 5, 5, 8}}},
|
|
ngraph::helpers::InputLayerType::CONSTANT,
|
|
{{1, 11, 5, 6, 4}},
|
|
defaultAxes5D.front()
|
|
}
|
|
};
|
|
|
|
const auto interpolateCasesLinearOnnx5D_Smoke = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
|
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
|
::testing::ValuesIn(defNearestModes),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
const auto interpolateCasesLinearOnnx5D_Full = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx),
|
|
::testing::ValuesIn(coordinateTransformModes_Full),
|
|
::testing::ValuesIn(defNearestModes),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesLinearOnnx5D_Smoke,
|
|
::testing::ValuesIn(shapeParams5D_Smoke),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice5D()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
INSTANTIATE_TEST_SUITE_P(InterpolateLinearOnnx5D_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesLinearOnnx5D_Full,
|
|
::testing::ValuesIn(shapeParams5D_Full),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice5D()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
const auto interpolateCasesNN5D_Smoke = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
|
::testing::ValuesIn(coordinateTransformModes_Smoke),
|
|
::testing::ValuesIn(nearestModes_Smoke),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
const auto interpolateCasesNN5D_Full = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
|
::testing::ValuesIn(coordinateTransformModes_Full),
|
|
::testing::ValuesIn(nearestModes_Full),
|
|
::testing::ValuesIn(antialias),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(pads5D),
|
|
::testing::ValuesIn(cubeCoefs));
|
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_InterpolateNN5D_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesNN5D_Smoke,
|
|
::testing::ValuesIn(shapeParams5D_Smoke),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice5D()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
INSTANTIATE_TEST_SUITE_P(InterpolateNN5D_Layout_Test, InterpolateLayerCPUTest,
|
|
::testing::Combine(
|
|
interpolateCasesNN5D_Full,
|
|
::testing::ValuesIn(shapeParams5D_Full),
|
|
::testing::Values(ElementType::f32),
|
|
::testing::ValuesIn(filterCPUInfoForDevice5D()),
|
|
::testing::ValuesIn(interpolateFusingParamsSet),
|
|
::testing::ValuesIn(filterAdditionalConfig())),
|
|
InterpolateLayerCPUTest::getTestCaseName);
|
|
|
|
// corner cases
|
|
const std::vector<ShapeParams> shapeParams4D_corner = {
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SCALES,
|
|
InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::PARAMETER,
|
|
{{1.f, 1.f, 1.25f, 1.5f}, {1.f, 1.f, 1.25f, 1.25f}},
|
|
defaultAxes4D.front()
|
|
},
|
|
ShapeParams{
|
|
ngraph::op::v4::Interpolate::ShapeCalcMode::SIZES,
|
|
InputShape{{1, 11, 4, 4}, {{1, 11, 4, 4}, {1, 11, 4, 4}}},
|
|
ngraph::helpers::InputLayerType::PARAMETER,
|
|
{{1, 11, 6, 7}, {1, 11, 8, 7}},
|
|
defaultAxes4D.front()
|
|
}
|
|
};
|
|
|
|
const auto interpolateCornerCases = ::testing::Combine(
|
|
::testing::Values(ngraph::op::v4::Interpolate::InterpolateMode::nearest),
|
|
::testing::Values(ngraph::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC),
|
|
::testing::Values(ngraph::op::v4::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
|
|
|
|
} // namespace CPULayerTestsDefinitions
|