Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Samsung/ONE
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8fb5db663b0bf09bd57403e2a72bb794d6ebc580
Choose a base ref
..
head repository: Samsung/ONE
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: eab43e1949ee8582f5857ec926d8df5ac3bc04bd
Choose a head ref
Showing with 53 additions and 62 deletions.
  1. +53 −62 compiler/luci/service/src/Nodes/CircleReshape.test.cpp
115 changes: 53 additions & 62 deletions compiler/luci/service/src/Nodes/CircleReshape.test.cpp
Original file line number Diff line number Diff line change
@@ -39,8 +39,7 @@ TEST(CloneNodeTest, clone_Reshape)
ASSERT_EQ(node_reshape->newShape()->dim(1), cloned_reshape->newShape()->dim(1));
}


TEST(ShapeRuleTest, reshape_by_const_static_input)
TEST(ShapeRuleTest, reshape_by_input_const_static)
{
auto g = loco::make_graph();
auto node_reshape = g->nodes()->create<luci::CircleReshape>();
@@ -72,7 +71,7 @@ TEST(ShapeRuleTest, reshape_by_const_static_input)
ASSERT_EQ(4, output_shape.dim(1).value());
}

TEST(ShapeRuleTest, reshape_by_const_dynamic_input)
TEST(ShapeRuleTest, reshape_by_input_const_dynamic)
{
auto g = loco::make_graph();
auto node_reshape = g->nodes()->create<luci::CircleReshape>();
@@ -104,62 +103,54 @@ TEST(ShapeRuleTest, reshape_by_const_dynamic_input)
ASSERT_EQ(4, output_shape.dim(1).value());
}

// TEST(ShapeRuleTest, reshape_by_node_static_input)
// {
// auto g = loco::make_graph();
// auto node_reshape = g->nodes()->create<luci::CircleReshape>();
// auto tensor_input = g->nodes()->create<luci::CircleInput>();
// auto shape_by_input = g->nodes()->create<luci::CircleInput>();

// tensor_input->dtype(loco::DataType::S32);
// tensor_input->shape({2, 3, 4});
// tensor_input->shape_status(luci::ShapeStatus::VALID);

// shape_by_input->dtype(loco::DataType::S32);
// shape_by_input->shape({6, 4});
// 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_TRUE(shape_inf_rule.infer(node_reshape, output_shape));

// ASSERT_EQ(2, output_shape.rank());
// ASSERT_TRUE(output_shape.dim(0).known());
// ASSERT_TRUE(output_shape.dim(1).known());
// ASSERT_EQ(6, output_shape.dim(0).value());
// ASSERT_EQ(4, output_shape.dim(1).value());
// }

// TEST(ShapeRuleTest, reshape_by_node_dynamic_input)
// {
// auto g = loco::make_graph();
// auto node_reshape = g->nodes()->create<luci::CircleReshape>();
// auto tensor_input = g->nodes()->create<luci::CircleInput>();
// auto shape_by_input = g->nodes()->create<luci::CircleInput>();

// tensor_input->dtype(loco::DataType::S32);
// tensor_input->shape({2, 3, 4});
// tensor_input->shape_status(luci::ShapeStatus::VALID);

// shape_by_input->dtype(loco::DataType::S32);
// shape_by_input->rank(2);
// shape_by_input->dim(0).unset();
// shape_by_input->dim(1).unset();
// 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_TRUE(shape_inf_rule.infer(node_reshape, output_shape));

// ASSERT_EQ(2, output_shape.rank());
// ASSERT_FALSE(output_shape.dim(0).known());
// ASSERT_FALSE(output_shape.dim(1).known());
// }
TEST(ShapeRuleTest, reshape_input_tensor_undefined_NEG)
{
auto g = loco::make_graph();
auto node_reshape = g->nodes()->create<luci::CircleReshape>();
auto tensor_input = g->nodes()->create<luci::CircleInput>();
auto shape_by_input = g->nodes()->create<luci::CircleConst>();

tensor_input->dtype(loco::DataType::S32);
tensor_input->shape({2, 3, 4});
tensor_input->shape_status(luci::ShapeStatus::UNDEFINED);

shape_by_input->dtype(loco::DataType::S32);
shape_by_input->size<loco::DataType::S32>(2);
shape_by_input->at<loco::DataType::S32>(0) = 6;
shape_by_input->at<loco::DataType::S32>(1) = 4;
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_FALSE(shape_inf_rule.infer(node_reshape, output_shape));
}

TEST(ShapeRuleTest, reshape_input_shape_undefined_NEG)
{
auto g = loco::make_graph();
auto node_reshape = g->nodes()->create<luci::CircleReshape>();
auto tensor_input = g->nodes()->create<luci::CircleInput>();
auto shape_by_input = g->nodes()->create<luci::CircleConst>();

tensor_input->dtype(loco::DataType::S32);
tensor_input->shape({2, 3, 4});
tensor_input->shape_status(luci::ShapeStatus::VALID);

shape_by_input->dtype(loco::DataType::S32);
shape_by_input->size<loco::DataType::S32>(2);
shape_by_input->at<loco::DataType::S32>(0) = 6;
shape_by_input->at<loco::DataType::S32>(1) = 4;
shape_by_input->shape_status(luci::ShapeStatus::UNDEFINED);

node_reshape->tensor(tensor_input);
node_reshape->shape(shape_by_input);

loco::TensorShape output_shape;
luci::sinf::Rule shape_inf_rule;

ASSERT_FALSE(shape_inf_rule.infer(node_reshape, output_shape));
}