Skip to content

Commit

Permalink
[CPU] fix issue that reshape node didn't update last second input val…
Browse files Browse the repository at this point in the history
…ue (#21369)

* fix didn't udpate last second input issue

Signed-off-by: HU Yuan2 <[email protected]>

* to match master code

Signed-off-by: HU Yuan2 <[email protected]>

* fix review comment

use parametrized test case instead of creating new test case

Signed-off-by: HU Yuan2 <[email protected]>

---------

Signed-off-by: HU Yuan2 <[email protected]>
  • Loading branch information
tiger100256-hu authored Dec 4, 2023
1 parent 94d1d7a commit 0d05f87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugins/intel_cpu/src/nodes/reshape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -81,6 +78,9 @@ bool Reshape::needShapeInfer() const {
return true;
}
}
if (inputShapesModified()) {
return true;
}
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0d05f87

Please sign in to comment.