From 95d3d6023d5d2458d7c593e7e7b4e0787a46b1c2 Mon Sep 17 00:00:00 2001 From: Hyukjin Jeong Date: Mon, 19 Aug 2024 16:50:33 +0900 Subject: [PATCH] [luci] Infer dynamic shape for concat This infers dynamic shape for concat Op. ONE-DCO-1.0-Signed-off-by: Hyukjin Jeong --- .../service/src/CircleShapeInferenceRule.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/compiler/luci/service/src/CircleShapeInferenceRule.cpp b/compiler/luci/service/src/CircleShapeInferenceRule.cpp index 63eb4fb7e37..1837f20f58e 100644 --- a/compiler/luci/service/src/CircleShapeInferenceRule.cpp +++ b/compiler/luci/service/src/CircleShapeInferenceRule.cpp @@ -579,6 +579,23 @@ loco::NodeShape infer_concatenation(const luci::CircleConcatenation *node) } } + std::vector dynamic_dims(first_shape.rank(), false); + for (uint32_t i = 0; i < node->numValues(); ++i) + { + auto input_shape = luci::shape_get(node->values(i)).as(); + for (uint32_t j = 0; j < input_shape.rank(); ++j) + { + if (not input_shape.dim(j).known()) + dynamic_dims.at(j) = true; + } + } + + for (uint32_t i = 0; i < output_shape.rank(); ++i) + { + if (dynamic_dims.at(i)) + output_shape.dim(i).unset(); + } + return loco::NodeShape{output_shape}; }