[GPU] Fix Interpolate axes values alignment with scales (#12634)
This commit is contained in:
parent
fcf20dee86
commit
30b872150a
@ -43,7 +43,7 @@ static void CreateInterpolateOp(Program& p, const std::shared_ptr<ngraph::op::v4
|
||||
ov::normalize_axes(op.get(), inputRank, axes);
|
||||
} else {
|
||||
for (size_t i = 0; i < inputRank; ++i) {
|
||||
ov::normalize_axis(op.get(), i, inputRank);
|
||||
axes.push_back(ov::normalize_axis(op.get(), i, inputRank));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,8 @@ const std::vector<std::vector<int64_t>> defaultAxes = {
|
||||
{0, 1, 2, 3}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> emptyAxes = {{}};
|
||||
|
||||
const std::vector<std::vector<float>> defaultScales = {
|
||||
{1.f, 1.f, 2.f, 2.f}
|
||||
};
|
||||
@ -96,6 +98,18 @@ const auto interpolateCasesWithoutNearest = ::testing::Combine(
|
||||
::testing::ValuesIn(defaultAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
const auto interpolateCasesWithoutNearestEmptyAxes = ::testing::Combine(
|
||||
::testing::ValuesIn(modesWithoutNearest),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
::testing::ValuesIn(coordinateTransformModes),
|
||||
::testing::ValuesIn(defaultNearestMode),
|
||||
::testing::ValuesIn(antialias),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(pads),
|
||||
::testing::ValuesIn(cubeCoefs),
|
||||
::testing::ValuesIn(emptyAxes),
|
||||
::testing::ValuesIn(defaultScales));
|
||||
|
||||
const auto interpolateCasesNearesMode = ::testing::Combine(
|
||||
::testing::ValuesIn(nearestMode),
|
||||
::testing::ValuesIn(shapeCalculationMode),
|
||||
@ -121,6 +135,19 @@ INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_Basic, InterpolateLayerTest, ::testin
|
||||
::testing::Values(additional_config)),
|
||||
InterpolateLayerTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_BasicEmptyAxes, InterpolateLayerTest, ::testing::Combine(
|
||||
interpolateCasesWithoutNearestEmptyAxes,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::ValuesIn(inShapes),
|
||||
::testing::ValuesIn(targetShapes),
|
||||
::testing::Values(CommonTestUtils::DEVICE_GPU),
|
||||
::testing::Values(additional_config)),
|
||||
InterpolateLayerTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Interpolate_Nearest, InterpolateLayerTest, ::testing::Combine(
|
||||
interpolateCasesNearesMode,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
|
@ -81,16 +81,25 @@ void InterpolateLayerTest::SetUp() {
|
||||
auto scales_const = ngraph::opset3::Constant(ngraph::element::Type_t::f32, {scales.size()}, scales);
|
||||
auto scalesInput = std::make_shared<ngraph::opset3::Constant>(scales_const);
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateAttrs interpolateAttributes{mode, shapeCalcMode, padBegin,
|
||||
padEnd, coordinateTransformMode, nearestMode, antialias, cubeCoef};
|
||||
|
||||
std::shared_ptr<ngraph::op::v4::Interpolate> interpolate;
|
||||
if (axes.empty()) {
|
||||
interpolate = std::make_shared<ngraph::op::v4::Interpolate>(params[0],
|
||||
sizesInput,
|
||||
scalesInput,
|
||||
interpolateAttributes);
|
||||
} else {
|
||||
auto axesConst = ngraph::opset3::Constant(ngraph::element::Type_t::i64, {axes.size()}, axes);
|
||||
auto axesInput = std::make_shared<ngraph::opset3::Constant>(axesConst);
|
||||
|
||||
ngraph::op::v4::Interpolate::InterpolateAttrs interpolateAttributes{mode, shapeCalcMode, padBegin,
|
||||
padEnd, coordinateTransformMode, nearestMode, antialias, cubeCoef};
|
||||
auto interpolate = std::make_shared<ngraph::op::v4::Interpolate>(params[0],
|
||||
interpolate = std::make_shared<ngraph::op::v4::Interpolate>(params[0],
|
||||
sizesInput,
|
||||
scalesInput,
|
||||
axesInput,
|
||||
interpolateAttributes);
|
||||
}
|
||||
const ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(interpolate)};
|
||||
function = std::make_shared<ngraph::Function>(results, params, "interpolate");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user