add single_layer_test for Interpolate-1 (#6133)
This commit is contained in:
@@ -51,4 +51,27 @@ protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
//Interpolate-1 test
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision, // Net precision
|
||||
InferenceEngine::Precision, // Input precision, output is the same
|
||||
InferenceEngine::Layout, // Input layout, output is the same
|
||||
InferenceEngine::SizeVector, // Input shapes
|
||||
InferenceEngine::SizeVector, // Target shapes
|
||||
std::string, // InterpolateMode
|
||||
ngraph::AxisSet, // Axes
|
||||
bool, // AntiAlias
|
||||
std::vector<size_t>, // Pads
|
||||
LayerTestsUtils::TargetDevice // Device name
|
||||
> Interpolate1LayerTestParams;
|
||||
|
||||
class Interpolate1LayerTest : public testing::WithParamInterface<Interpolate1LayerTestParams>,
|
||||
virtual public LayerTestsUtils::LayerTestsCommon {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<Interpolate1LayerTestParams> obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
||||
@@ -94,4 +94,69 @@ void InterpolateLayerTest::SetUp() {
|
||||
const ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(interpolate)};
|
||||
function = std::make_shared<ngraph::Function>(results, params, "interpolate");
|
||||
}
|
||||
|
||||
//Interpolate-1
|
||||
|
||||
std::string Interpolate1LayerTest::getTestCaseName(testing::TestParamInfo<Interpolate1LayerTestParams> obj) {
|
||||
InferenceEngine::Precision netPrecision;
|
||||
InferenceEngine::Precision dataPrecision;
|
||||
InferenceEngine::Layout dataLayout;
|
||||
InferenceEngine::SizeVector inputShapes, targetShapes;
|
||||
std::string mode;
|
||||
ngraph::AxisSet axes;
|
||||
bool antialias;
|
||||
std::vector<size_t> pads;
|
||||
std::string targetDevice;
|
||||
std::tie(netPrecision, dataPrecision, dataLayout, inputShapes, targetShapes,
|
||||
mode, axes, antialias, pads, targetDevice) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
|
||||
result << "TS=" << CommonTestUtils::vec2str(targetShapes) << "_";
|
||||
result << "InterpolateMode=" << mode << "_";
|
||||
result << "Antialias=" << antialias << "_";
|
||||
result << "PB=" << CommonTestUtils::vec2str(pads) << "_";
|
||||
result << "PE=" << CommonTestUtils::vec2str(pads) << "_";
|
||||
result << "Axes=" << CommonTestUtils::vec2str(axes.to_vector()) << "_";
|
||||
result << "netPRC=" << netPrecision.name() << "_";
|
||||
result << "PRC=" << dataPrecision.name() << "_";
|
||||
result << "Layout=" << dataLayout << "_";
|
||||
result << "trgDev=" << targetDevice;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void Interpolate1LayerTest::SetUp() {
|
||||
std::vector<size_t> inputShape, targetShape;
|
||||
auto netPrecision = InferenceEngine::Precision::UNSPECIFIED;
|
||||
InferenceEngine::Precision dataPrecision;
|
||||
InferenceEngine::Layout dataLayout;
|
||||
std::string mode;
|
||||
ngraph::AxisSet axes;
|
||||
bool antialias;
|
||||
std::vector<size_t> pads;
|
||||
std::tie(netPrecision, dataPrecision, dataLayout, inputShape, targetShape,
|
||||
mode, axes, antialias, pads, targetDevice) = this->GetParam();
|
||||
|
||||
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
|
||||
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
|
||||
|
||||
auto sizesConst = ngraph::opset3::Constant(ngraph::element::Type_t::i64, {targetShape.size()}, targetShape);
|
||||
auto sizesInput = std::make_shared<ngraph::opset3::Constant>(sizesConst);
|
||||
|
||||
bool align_corners = true;
|
||||
|
||||
ngraph::op::v0::InterpolateAttrs interpolateAttributes;
|
||||
interpolateAttributes.axes = axes;
|
||||
interpolateAttributes.mode = mode;
|
||||
interpolateAttributes.align_corners = align_corners;
|
||||
interpolateAttributes.antialias = antialias;
|
||||
interpolateAttributes.pads_begin = pads;
|
||||
interpolateAttributes.pads_end = pads;
|
||||
|
||||
auto interpolate = std::make_shared<ngraph::op::v0::Interpolate>(params[0], sizesInput, interpolateAttributes);
|
||||
|
||||
const ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(interpolate)};
|
||||
function = std::make_shared<ngraph::Function>(results, params, "interpolate");
|
||||
}
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
||||
Reference in New Issue
Block a user