Skip to content

Commit

Permalink
[luci] Infer dynamic shape for concat
Browse files Browse the repository at this point in the history
This infers dynamic shape for concat Op.

ONE-DCO-1.0-Signed-off-by: Hyukjin Jeong <[email protected]>
  • Loading branch information
jinevening committed Aug 19, 2024
1 parent 8f98b9a commit 95d3d60
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions compiler/luci/service/src/CircleShapeInferenceRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,23 @@ loco::NodeShape infer_concatenation(const luci::CircleConcatenation *node)
}
}

std::vector<bool> 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<loco::TensorShape>();
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};
}

Expand Down

0 comments on commit 95d3d60

Please sign in to comment.