From 62f79c3222a0ea2e6ca9bd94955249bc6fdf3577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Do=C5=82bniak?= Date: Wed, 3 Aug 2022 11:47:22 +0200 Subject: [PATCH] GroupedGatherElimination short circuit (#12380) * Disable GroupedGatherElimination in case of scalar inputs containing indices * clang format --- .../simplify_shape_of_sub_graph.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp b/src/common/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp index c33b88b09d3..b6d08888c23 100644 --- a/src/common/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp @@ -75,7 +75,16 @@ ngraph::pass::GroupedGatherElimination::GroupedGatherElimination() { (curr->input_value(0) != next->input_value(0))) { ++i; continue; - } // curr and next are the same type of gather which takes data from the same source + } + + // Scalar inputs are not supported by Concat and we don't want to throw an exception here. + // The transformation should not be applied instead. + if (curr->input_value(1).get_partial_shape().same_scheme(Shape{}) || + next->input_value(1).get_partial_shape().same_scheme(Shape{})) { + return false; + } + + // curr and next are the same type of gather which takes data from the same source auto joint_indices = ngraph::op::util::make_try_fold( OutputVector{curr->input_value(1), next->input_value(1)}, 0);