Skip to content

Commit

Permalink
Return nullptr for unsupported case
Browse files Browse the repository at this point in the history
  • Loading branch information
dayo09 committed Jan 17, 2025
1 parent 94be72a commit b65c847
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/luci/pass/src/ExpandBroadcastConstPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ luci::CircleConst *create_expanded_constant(luci::CircleConst *node, luci::Circl
return nullptr;
}

if (successor->rank() == 1 || successor->rank() > 4)
{
WARN(l) << "NYI: Only 2D/3D/4D tensor broadcast removal is supported";
return nullptr;
}

auto constant = node->graph()->nodes()->create<luci::CircleConst>();
constant->name(node->name());
constant->dtype(node->dtype());
Expand All @@ -64,7 +70,6 @@ luci::CircleConst *create_expanded_constant(luci::CircleConst *node, luci::Circl
auto const node_data = &node->at<loco::DataType::FLOAT32>(0);
auto const constant_data = &constant->at<loco::DataType::FLOAT32>(0);

assert(successor->rank() >= 2 && successor->rank() <= 4);
if (successor->rank() == 2)
{
auto const N = successor->dim(successor->rank() - 2).value();
Expand Down

0 comments on commit b65c847

Please sign in to comment.