diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp index cbfb69d9ab72d3..b7c80cb029717b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp @@ -22,23 +22,28 @@ const std::vector versions = { LayerTestsUtils::LayerTransformation::LptVersion::nGraph }; -const std::vector interpAttrs = { - // { - // ngraph::AxisSet{2, 3}, - // "nearest", - // false, - // false, - // {0}, - // {0} - // }, - // { - // ngraph::AxisSet{2, 3}, - // "nearest", - // false, - // true, - // {0}, - // {0} - // }, +const std::vector interpAttrs = { + interpAttributes( + ngraph::AxisSet{2, 3}, + "nearest", + false, + false, + {0}, + {0}), + interpAttributes( + ngraph::AxisSet{2, 3}, + "nearest", + false, + true, + {0}, + {0}), + interpAttributes( + ngraph::AxisSet{2, 3}, + "linear", + false, + false, + {0}, + {0}), }; const auto combineValues = ::testing::Combine( diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp index 8ef00c67fb68cf..5daf524bf2d891 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp @@ -11,11 +11,35 @@ namespace LayerTestsDefinitions { +class interpAttributes { +public: + ngraph::AxisSet axes; + std::string mode; + bool align_corners; + bool antialias; + std::vector pads_begin; + std::vector pads_end; + + bool shouldBeTransformed; + + interpAttributes() = default; + + interpAttributes(const ngraph::AxisSet& axes, + const std::string& mode, + const bool& align_corners, + const bool& antialias, + const std::vector& pads_begin, + const std::vector& pads_end, + const bool& shouldBeTransformed = true) : + axes(axes), mode(mode), align_corners(align_corners), + antialias(antialias), pads_begin(pads_begin), pads_end(pads_end) {} +}; + typedef std::tuple< ngraph::element::Type, std::pair, std::string, - ngraph::op::InterpolateAttrs, + interpAttributes, LayerTestsUtils::LayerTransformation::LptVersion> InterpolateTransformationParams; class InterpolateTransformation : diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp index ea99024fec5a66..8618df1e446dac 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp @@ -17,14 +17,14 @@ namespace LayerTestsDefinitions { template inline std::ostream& operator<<(std::ostream& os, const std::vector& values) { - os << "{ "; + os << "{"; for (size_t i = 0; i < values.size(); ++i) { os << values[i]; if (i != (values.size() - 1ul)) { - os << ", "; + os << ","; } } - os << " }"; + os << "}"; return os; } @@ -32,20 +32,20 @@ std::string InterpolateTransformation::getTestCaseName(testing::TestParamInfo shapes; std::string targetDevice; - ngraph::op::InterpolateAttrs interpAttrs; + interpAttributes attributes; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); LayerTestsUtils::LayerTransformation::LptVersion version; - std::tie(precision, shapes, targetDevice, interpAttrs, version) = obj.param; + std::tie(precision, shapes, targetDevice, attributes, version) = obj.param; std::ostringstream result; - result << getTestCaseNameByParams(precision, shapes.first, targetDevice, params, version) << - "_" << shapes.second << "_" << - interpAttrs.align_corners << - interpAttrs.antialias << - interpAttrs.axes << - interpAttrs.mode << - interpAttrs.pads_begin << - interpAttrs.pads_end; + result << getTestCaseNameByParams(precision, shapes.first, targetDevice, params, version) << "_" << + shapes.second << "_" << + attributes.align_corners << "_" << + attributes.antialias << "_" << + attributes.axes << "_" << + attributes.mode << "_" << + attributes.pads_begin << "_" << + attributes.pads_end; return result.str(); } @@ -53,10 +53,18 @@ void InterpolateTransformation::SetUp() { SetRefMode(LayerTestsUtils::RefMode::IE); ngraph::element::Type precision; std::pair shapes; - ngraph::op::InterpolateAttrs interpAttrs; + interpAttributes attributes; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); LayerTestsUtils::LayerTransformation::LptVersion version; - std::tie(precision, shapes, targetDevice, interpAttrs, version) = this->GetParam(); + std::tie(precision, shapes, targetDevice, attributes, version) = this->GetParam(); + + ngraph::op::InterpolateAttrs interpAttrs; + interpAttrs.axes = attributes.axes; + interpAttrs.mode = attributes.mode; + interpAttrs.align_corners = attributes.align_corners; + interpAttrs.antialias = attributes.antialias; + interpAttrs.pads_begin = attributes.pads_begin; + interpAttrs.pads_end = attributes.pads_end; ConfigurePlugin(version); @@ -71,7 +79,7 @@ void InterpolateTransformation::validate() { ngraph::element::Type precision; std::pair shapes; std::string targetDevice; - ngraph::op::InterpolateAttrs interpAttrs; + interpAttributes interpAttrs; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); LayerTestsUtils::LayerTransformation::LptVersion version; std::tie(precision, shapes, targetDevice, interpAttrs, version) = this->GetParam(); @@ -86,16 +94,16 @@ void InterpolateTransformation::validate() { std::map::iterator it = outputs.begin(); const InferenceEngine::CNNLayerPtr outputLayer = getCreatorLayer(it->second).lock(); EXPECT_TRUE(outputLayer != nullptr); - EXPECT_EQ("ScaleShift", outputLayer->type); + EXPECT_EQ(interpAttrs.mode == "linear" ? "Interp" : "ScaleShift", outputLayer->type); EXPECT_EQ(1ul, outputLayer->insData.size()); const InferenceEngine::DataPtr insData = outputLayer->insData[0].lock(); EXPECT_TRUE(insData != nullptr); const InferenceEngine::CNNLayerPtr interpolate = getCreatorLayer(insData).lock(); EXPECT_TRUE(interpolate != nullptr); - EXPECT_EQ("Resample", interpolate->type); + EXPECT_EQ(interpAttrs.mode == "linear" ? "ScaleShift" : "Resample", interpolate->type); - if (params.updatePrecisions) { + if (params.updatePrecisions && interpAttrs.mode == "nearest") { const InferenceEngine::Precision precision = interpolate->outData[0]->getTensorDesc().getPrecision(); EXPECT_TRUE((precision == InferenceEngine::Precision::U8) || (precision == InferenceEngine::Precision::I8)); }