[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 authored and GitHub committed 2023-12-04 18:23:42 +01:00
1 parent 94d1d7a033
commit 0d05f87004
2 files changed
+17 -3

No files matched your search

+3 -3
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;
}
@@ -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 {