Skip to content

Commit

Permalink
add assert to check div by zero and rewrite checkKernel function
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Balyshev committed Feb 22, 2024
1 parent 782e549 commit 6ff2ebf
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_F(Conv2DTest, Float_P)
{
onert_micro::test_model::TestDataFloatConv2D test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector,
FloatArrayNear(test_data_kernel.get_output_data_by_index(0), 0.0001f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_F(FullyConnectedTest, Float_P)
{
onert_micro::test_model::TestDataFloatFullyConnected test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ TEST_F(GatherTest, Gather_Float_P)
{
onert_micro::test_model::TestDataFloatGather test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

TEST_F(GatherTest, Gather_Int_P)
{
onert_micro::test_model::TestDataIntGather test_data_kernel;
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<int32_t>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<int32_t>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_F(LogisticTest, Float_P)
{
onert_micro::test_model::TestDataFloatLogistic test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_F(MaxPool2DTest, Float_P)
{
onert_micro::test_model::TestDataFloatMaxPool2D test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ TEST_F(MulTest, INT_P)
const bool is_with_broadcast = false;
test_model::TestDataIntMul test_data_add_no_broadcasting(is_with_broadcast);
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<int32_t>(&test_data_add_no_broadcasting);
onert_micro::execute::testing::checkKernel<int32_t>(2, &test_data_add_no_broadcasting);
EXPECT_THAT(output_data_vector, test_data_add_no_broadcasting.get_output_data_by_index(0));
}
// With broadcast
{
const bool is_with_broadcast = true;
test_model::TestDataIntMul test_data_add_with_broadcasting(is_with_broadcast);
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<int32_t>(&test_data_add_with_broadcasting);
onert_micro::execute::testing::checkKernel<int32_t>(2, &test_data_add_with_broadcasting);
EXPECT_THAT(output_data_vector, test_data_add_with_broadcasting.get_output_data_by_index(0));
}
}
Expand All @@ -60,7 +60,7 @@ TEST_F(MulTest, Float_P)
const bool is_with_broadcast = false;
test_model::TestDataFloatMul test_data_float_add_no_broadcasting(is_with_broadcast);
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<float>(&test_data_float_add_no_broadcasting);
onert_micro::execute::testing::checkKernel<float>(2, &test_data_float_add_no_broadcasting);
EXPECT_THAT(
output_data_vector,
FloatArrayNear(test_data_float_add_no_broadcasting.get_output_data_by_index(0), 0.0001f));
Expand All @@ -70,7 +70,7 @@ TEST_F(MulTest, Float_P)
const bool is_with_broadcast = true;
test_model::TestDataFloatMul test_data_float_add_with_broadcasting(is_with_broadcast);
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<float>(&test_data_float_add_with_broadcasting);
onert_micro::execute::testing::checkKernel<float>(2, &test_data_float_add_with_broadcasting);
EXPECT_THAT(
output_data_vector,
FloatArrayNear(test_data_float_add_with_broadcasting.get_output_data_by_index(0), 0.0001f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ TEST_F(PackTest, Float_P)
{
test_model::TestDataFloatPack test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(2, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

TEST_F(PackTest, Int_P)
{
test_model::TestDataIntPack test_data_kernel;
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<int32_t>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<int32_t>(2, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ TEST_F(ReduceProdTest, Reduce_Prod_Float_P)
{
onert_micro::test_model::TestDataFloatReduceProd test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

TEST_F(ReduceProdTest, Reduce_Prod_Int_P)
{
onert_micro::test_model::TestDataIntReduceProd test_data_kernel;
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<int32_t>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<int32_t>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ TEST_F(ReshapeTest, MainTest_P)
{
onert_micro::test_model::TestDataReshapeKernel<float> test_data_kernel(false);
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

TEST_F(ReshapeTest, MainTest_NEG)
{
onert_micro::test_model::TestDataReshapeKernel<float> test_data_kernel(true);
EXPECT_DEATH(checkSISOKernel(&test_data_kernel), "");
EXPECT_DEATH(checkKernel(1, &test_data_kernel), "");
}

} // namespace testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_F(ShapeTest, MainTest_P)
{
onert_micro::test_model::TestDataShapeKernel<float, int32_t> test_data_kernel;
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float, int32_t>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float, int32_t>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST_F(StridedSliceTest, MainTest_P)
{
onert_micro::test_model::TestDataStridedSliceKernel<float> test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector, test_data_kernel.get_output_data_by_index(0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ TEST_F(SubTest, INT_P)
const bool is_with_broadcast = false;
test_model::TestDataIntSub test_data_add_no_broadcasting(is_with_broadcast);
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<int32_t>(&test_data_add_no_broadcasting);
onert_micro::execute::testing::checkKernel<int32_t>(2, &test_data_add_no_broadcasting);
EXPECT_THAT(output_data_vector, test_data_add_no_broadcasting.get_output_data_by_index(0));
}
// With broadcast
{
const bool is_with_broadcast = true;
test_model::TestDataIntSub test_data_add_with_broadcasting(is_with_broadcast);
std::vector<int32_t> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<int32_t>(&test_data_add_with_broadcasting);
onert_micro::execute::testing::checkKernel<int32_t>(2, &test_data_add_with_broadcasting);
EXPECT_THAT(output_data_vector, test_data_add_with_broadcasting.get_output_data_by_index(0));
}
}
Expand All @@ -60,7 +60,7 @@ TEST_F(SubTest, Float_P)
const bool is_with_broadcast = false;
test_model::TestDataFloatSub test_data_float_add_no_broadcasting(is_with_broadcast);
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<float>(&test_data_float_add_no_broadcasting);
onert_micro::execute::testing::checkKernel<float>(2, &test_data_float_add_no_broadcasting);
EXPECT_THAT(
output_data_vector,
FloatArrayNear(test_data_float_add_no_broadcasting.get_output_data_by_index(0), 0.0001f));
Expand All @@ -70,7 +70,7 @@ TEST_F(SubTest, Float_P)
const bool is_with_broadcast = true;
test_model::TestDataFloatSub test_data_float_add_with_broadcasting(is_with_broadcast);
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkTISOKernel<float>(&test_data_float_add_with_broadcasting);
onert_micro::execute::testing::checkKernel<float>(2, &test_data_float_add_with_broadcasting);
EXPECT_THAT(
output_data_vector,
FloatArrayNear(test_data_float_add_with_broadcasting.get_output_data_by_index(0), 0.0001f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST_F(UnidirLSTMTest, Float_P)
{
onert_micro::test_model::TestDataFloatUnidirectionalLSTM test_data_kernel;
std::vector<float> output_data_vector =
onert_micro::execute::testing::checkSISOKernel<float>(&test_data_kernel);
onert_micro::execute::testing::checkKernel<float>(1, &test_data_kernel);
EXPECT_THAT(output_data_vector,
FloatArrayNear(test_data_kernel.get_output_data_by_index(0), 0.0001f));
}
Expand Down

0 comments on commit 6ff2ebf

Please sign in to comment.