diff --git a/compiler/luci/service/src/Nodes/CircleReshape.test.cpp b/compiler/luci/service/src/Nodes/CircleReshape.test.cpp index 97ecd30664c..363ec641a66 100644 --- a/compiler/luci/service/src/Nodes/CircleReshape.test.cpp +++ b/compiler/luci/service/src/Nodes/CircleReshape.test.cpp @@ -135,6 +135,33 @@ TEST(ShapeRuleTest, reshape_should_infer) ASSERT_EQ(4, output_shape.dim(1).value()); } +TEST(ShapeRuleTest, reshape_zero_rank_mismatch_NEG) +{ + auto g = loco::make_graph(); + auto node_reshape = g->nodes()->create(); + auto tensor_input = g->nodes()->create(); + auto shape_by_input = g->nodes()->create(); + + tensor_input->dtype(loco::DataType::S32); + tensor_input->shape({2, 4}); + tensor_input->shape_status(luci::ShapeStatus::VALID); + + shape_by_input->dtype(loco::DataType::S32); + shape_by_input->size(3); + shape_by_input->at(0) = 2; + shape_by_input->at(1) = 2; + shape_by_input->at(2) = 0; + shape_by_input->shape_status(luci::ShapeStatus::VALID); + + node_reshape->tensor(tensor_input); + node_reshape->shape(shape_by_input); + + loco::TensorShape output_shape; + luci::sinf::Rule shape_inf_rule; + + ASSERT_THROW(shape_inf_rule.infer(node_reshape, output_shape), oops::InternalExn); +} + TEST(ShapeRuleTest, reshape_wrong_target_shape_NEG) { auto g = loco::make_graph();