From ca36b91a7378823893eeec67742e71810c023071 Mon Sep 17 00:00:00 2001 From: Maksim Kutakov Date: Mon, 16 Nov 2020 15:58:10 +0300 Subject: [PATCH] [CPU] Broadcast check has been added to the ConvertPowerToPowerIEMatcher transformation. (#3132) * [CPU] Added broadcast check to the ConvertPowerToPowerIE transformation. * [CPU] Eltwise single layer test instance extended with a two inputs case. --- .../convert_opset1_to_legacy/convert_power_to_power_ie.cpp | 7 ++++++- .../cpu/shared_tests_instances/single_layer_tests/eltwise.cpp | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp index 14f6aa3..67471fa 100644 --- a/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp +++ b/inference-engine/src/legacy_api/src/transformations/convert_opset1_to_legacy/convert_power_to_power_ie.cpp @@ -33,6 +33,11 @@ ngraph::pass::ConvertPowerToPowerIEMatcher::ConvertPowerToPowerIEMatcher() { return false; } + //check broadcast influence + if (ngraph::op::util::check_for_broadcast(power->input(0).get_shape(), node->get_shape())) { + return false; + } + auto power_ie = std::make_shared(power->input(0).get_source_output(), value, 1.0f, 0.0f, power->output(0).get_element_type()); power_ie->set_friendly_name(power->get_friendly_name()); ngraph::copy_runtime_info(power, power_ie); @@ -44,4 +49,4 @@ ngraph::pass::ConvertPowerToPowerIEMatcher::ConvertPowerToPowerIEMatcher() { auto m = std::make_shared(power, "ConvertPowerToPowerIE"); this->register_matcher(m, callback); -} +} \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/eltwise.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/eltwise.cpp index 75ada84..66863b9 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/eltwise.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/eltwise.cpp @@ -16,6 +16,8 @@ std::vector>> inShapes = { {{1, 10, 100}}, {{4, 4, 16}}, {{1, 1, 1, 3}}, + {{2, 17, 5, 4}, {1, 17, 1, 1}}, + {{2, 17, 5, 1}, {1, 17, 1, 4}}, {{1, 2, 4}}, {{1, 4, 4}}, {{1, 4, 4, 1}}, -- 2.7.4