6 #include <boost/test/unit_test.hpp> 8 #include "../TfLiteParser.hpp" 15 explicit ActivationFixture(std::string activationFunction, std::string dataType)
20 "operator_codes": [ { "builtin_code": )" + activationFunction + R"( } ], 25 "type": )" + dataType + R"(, 27 "name": "inputTensor", 37 "type": )" + dataType + R"(, 39 "name": "outputTensor", 55 "custom_options_format": "FLEXBUFFERS" 59 "buffers" : [ {}, {} ] 67 struct ReLuFixture : ActivationFixture
69 ReLuFixture() : ActivationFixture(
"RELU",
"FLOAT32") {}
73 RunTest<2, armnn::DataType::Float32>(0, { -1.0f, -0.5f, 1.25f, -3.0f, 0.0f, 0.5f, -0.75f },
74 { 0.0f, 0.0f, 1.25f, 0.0f, 0.0f, 0.5f, 0.0f });
77 struct ReLu6Fixture : ActivationFixture
79 ReLu6Fixture() : ActivationFixture(
"RELU6",
"FLOAT32") {}
83 RunTest<2, armnn::DataType::Float32>(0, { -1.0f, -0.5f, 7.25f, -3.0f, 0.0f, 0.5f, -0.75f },
84 { 0.0f, 0.0f, 6.0f, 0.0f, 0.0f, 0.5f, 0.0f });
87 struct SigmoidFixture : ActivationFixture
89 SigmoidFixture() : ActivationFixture(
"LOGISTIC",
"FLOAT32") {}
93 RunTest<2, armnn::DataType::Float32>(0, { -1.0f, -0.5f, 4.0f, -4.0f, 0.0f, 0.5f, -0.75f },
94 {0.268941f, 0.377541f, 0.982013f, 0.0179862f, 0.5f, 0.622459f, 0.320821f });
97 struct TanHFixture : ActivationFixture
99 TanHFixture() : ActivationFixture(
"TANH",
"FLOAT32") {}
104 RunTest<2, armnn::DataType::Float32>(0,
105 { -0.1f, -0.2f, -0.3f, -0.4f, 0.1f, 0.2f, 0.3f },
106 { -0.09966799f, -0.19737528f, -0.29131261f, -0.379949f, 0.09966799f, 0.19737528f, 0.29131261f });
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(ParseReLu, ReLuFixture)
BOOST_AUTO_TEST_SUITE_END()
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)