6 #include <boost/test/unit_test.hpp> 8 #include "../Deserializer.hpp" 17 explicit L2NormalizationFixture(
const std::string &inputShape,
18 const std::string &outputShape,
19 const std::string &dataType,
20 const std::string &dataLayout,
21 const std::string epsilon)
29 layer_type: "InputLayer", 35 layerName: "InputLayer", 39 connection: {sourceLayerIndex:0, outputSlotIndex:0 }, 44 dimensions: )" + inputShape + R"(, 45 dataType: ")" + dataType + R"(", 46 quantizationScale: 0.5, 55 layer_type: "L2NormalizationLayer", 59 layerName: "L2NormalizationLayer", 60 layerType: "L2Normalization", 63 connection: {sourceLayerIndex:0, outputSlotIndex:0 }, 68 dimensions: )" + outputShape + R"(, 69 dataType: ")" + dataType + R"(" 74 dataLayout: ")" + dataLayout + R"(", 75 eps: )" + epsilon + R"( 80 layer_type: "OutputLayer", 86 layerName: "OutputLayer", 90 connection: {sourceLayerIndex:1, outputSlotIndex:0 }, 95 dimensions: )" + outputShape + R"(, 96 dataType: ")" + dataType + R"(" 108 struct L2NormFixture : L2NormalizationFixture
111 L2NormFixture():L2NormalizationFixture(
"[ 1, 3, 1, 1 ]",
121 const float approxInvL2Norm = 0.267261f;
123 RunTest<4, armnn::DataType::Float32>(0,
124 {{
"InputLayer", { 1.0f, 2.0f, 3.0f }}},
125 {{
"OutputLayer",{ 1.0f * approxInvL2Norm,
126 2.0f * approxInvL2Norm,
127 3.0f * approxInvL2Norm }}});
133 const float approxInvL2Norm = 10000;
135 RunTest<4, armnn::DataType::Float32>(0,
136 {{
"InputLayer", { 0.00000001f, 0.00000002f, 0.00000003f }}},
137 {{
"OutputLayer",{ 0.00000001f * approxInvL2Norm,
138 0.00000002f * approxInvL2Norm,
139 0.00000003f * approxInvL2Norm }}});
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_FIXTURE_TEST_CASE(L2NormalizationFloat32, L2NormFixture)