[CPU] fix issue that reshape node didn't update last second input value (#21369)

* fix didn't udpate last second input issue

Signed-off-by: HU Yuan2 <yuan2.hu@intel.com>

* to match master code

Signed-off-by: HU Yuan2 <yuan2.hu@intel.com>

* fix review comment

use parametrized test case instead of creating new test case

Signed-off-by: HU Yuan2 <yuan2.hu@intel.com>

---------

Signed-off-by: HU Yuan2 <yuan2.hu@intel.com>
This commit is contained in:
Yuan Hu 2023-12-05 01:23:42 +08:00 committed by GitHub
parent 94d1d7a033
commit 0d05f87004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -65,9 +65,6 @@ Reshape::Reshape(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr c
}
bool Reshape::needShapeInfer() const {
if (inputShapesModified()) {
return true;
}
const auto& mem = getParentEdgesAtPort(1)[0]->getMemory();
if (lastSecondInputValues.empty()) {
lastSecondInputValues.resize(mem.getStaticDims()[0], 0);
@ -81,6 +78,9 @@ bool Reshape::needShapeInfer() const {
return true;
}
}
if (inputShapesModified()) {
return true;
}
return false;
}

View File

@ -280,6 +280,20 @@ const auto params_EmptyTensor = ::testing::Combine(::testing::Values(shape_Empty
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_EmptyTensor, ShapeOpsCPUTest, params_EmptyTensor, ShapeOpsCPUTest::getTestCaseName);
// test cases about NeedShapeInfer return right result
inputDescription shape_NeedShapeInfer{{{-1, -1},
{ngraph::Shape{640, 80}, ngraph::Shape{640, 80}, ngraph::Shape{1280, 40}, ngraph::Shape{1280, 40}}},
{std::vector<int>{320, 160}, std::vector<int>{640, 80}, std::vector<int>{320, 160}, std::vector<int>{640, 80}}};
const auto params_NeedShapeInfer = ::testing::Combine(::testing::Values(shape_NeedShapeInfer),
::testing::Values(ngraph::helpers::InputLayerType::PARAMETER),
::testing::Values(shapeNodeType::Reshape),
::testing::Values(Precision::FP32),
::testing::ValuesIn(secondInPrcs),
::testing::Values(false));
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_NeedShapeInfer, ShapeOpsCPUTest, params_NeedShapeInfer, ShapeOpsCPUTest::getTestCaseName);
} // namespace reshapeTest
namespace squeezeTest {