[CPU] Fixed performance for Eltwise with C=1 (#8406)
This commit is contained in:
parent
a862331732
commit
75af8254cb
@ -1398,7 +1398,7 @@ void MKLDNNEltwiseNode::prepareParams() {
|
||||
break;
|
||||
|
||||
for (int j = 1; j < dims_in.size(); j++) {
|
||||
if (dims_in[j][dims_in[j].size() - 1] != dims_in[0][dims_in[0].size() - 1]) {
|
||||
if (dims_in[j].back() != dims_in[0].back()) {
|
||||
hasDifferentDims = true;
|
||||
}
|
||||
}
|
||||
@ -1410,11 +1410,6 @@ void MKLDNNEltwiseNode::prepareParams() {
|
||||
bool canCollapse = true;
|
||||
for (int i = 0; i < dims_in.size(); i++) {
|
||||
if (dims_in[i][dims_in[i].size() - 2] != 1) {
|
||||
if (dims_in[i][dims_in[i].size() - 1] == 1) {
|
||||
canCollapse = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hasDifferentDims) {
|
||||
canCollapse = false;
|
||||
break;
|
||||
|
@ -21,10 +21,21 @@ std::vector<std::vector<ov::Shape>> inShapesStatic = {
|
||||
{{1, 2, 4}},
|
||||
{{1, 4, 4}},
|
||||
{{1, 4, 4, 1}},
|
||||
{{16, 16, 16, 16, 16}},
|
||||
{{16, 16, 16, 16, 1}},
|
||||
{{16, 16, 16, 1, 16}},
|
||||
{{16, 32, 1, 1, 1}},
|
||||
{{1, 1, 1, 1, 1, 1, 3}},
|
||||
{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
|
||||
};
|
||||
|
||||
std::vector<std::vector<ov::Shape>> inShapesStaticCheckCollapse = {
|
||||
{{16, 16, 16, 16}, {16, 16, 16, 1}},
|
||||
{{16, 16, 16, 1}, {16, 16, 16, 1}},
|
||||
{{16, 16, 16, 16}, {16, 16, 1, 16}},
|
||||
{{16, 16, 1, 16}, {16, 16, 1, 16}},
|
||||
};
|
||||
|
||||
std::vector<std::vector<ov::test::InputShape>> inShapesDynamic = {
|
||||
{{{ngraph::Dimension(1, 10), 200}, {{2, 200}, {1, 200}}},
|
||||
{{ngraph::Dimension(1, 10), 200}, {{2, 200}, {5, 200}}}},
|
||||
@ -84,6 +95,17 @@ const auto multiply_params = ::testing::Combine(
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config));
|
||||
|
||||
const auto collapsing_params = ::testing::Combine(
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(inShapesStaticCheckCollapse)),
|
||||
::testing::ValuesIn(eltwiseOpTypes),
|
||||
::testing::ValuesIn(secondaryInputTypes),
|
||||
::testing::Values(opTypes[1]),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(ov::element::undefined),
|
||||
::testing::Values(ov::element::undefined),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(additional_config));
|
||||
|
||||
const auto multiply_params_dynamic = ::testing::Combine(
|
||||
::testing::ValuesIn(inShapesDynamic),
|
||||
::testing::ValuesIn(eltwiseOpTypesDynamic),
|
||||
@ -96,6 +118,7 @@ const auto multiply_params_dynamic = ::testing::Combine(
|
||||
::testing::Values(additional_config));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_static, EltwiseLayerTest, multiply_params, EltwiseLayerTest::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_static_check_collapsing, EltwiseLayerTest, collapsing_params, EltwiseLayerTest::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_dynamic, EltwiseLayerTest, multiply_params_dynamic, EltwiseLayerTest::getTestCaseName);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user