6 #include <boost/test/unit_test.hpp> 16 explicit L2NormalizationFixture(
const std::string &inputShape,
17 const std::string &outputShape,
18 const std::string &dataType,
19 const std::string &dataLayout,
20 const std::string epsilon)
28 layer_type: "InputLayer", 34 layerName: "InputLayer", 38 connection: {sourceLayerIndex:0, outputSlotIndex:0 }, 43 dimensions: )" + inputShape + R"(, 44 dataType: ")" + dataType + R"(", 45 quantizationScale: 0.5, 54 layer_type: "L2NormalizationLayer", 58 layerName: "L2NormalizationLayer", 59 layerType: "L2Normalization", 62 connection: {sourceLayerIndex:0, outputSlotIndex:0 }, 67 dimensions: )" + outputShape + R"(, 68 dataType: ")" + dataType + R"(" 73 dataLayout: ")" + dataLayout + R"(", 74 eps: )" + epsilon + R"( 79 layer_type: "OutputLayer", 85 layerName: "OutputLayer", 89 connection: {sourceLayerIndex:1, outputSlotIndex:0 }, 94 dimensions: )" + outputShape + R"(, 95 dataType: ")" + dataType + R"(" 107 struct L2NormFixture : L2NormalizationFixture
110 L2NormFixture():L2NormalizationFixture(
"[ 1, 3, 1, 1 ]",
120 const float approxInvL2Norm = 0.267261f;
122 RunTest<4, armnn::DataType::Float32>(0,
123 {{
"InputLayer", { 1.0f, 2.0f, 3.0f }}},
124 {{
"OutputLayer",{ 1.0f * approxInvL2Norm,
125 2.0f * approxInvL2Norm,
126 3.0f * approxInvL2Norm }}});
132 const float approxInvL2Norm = 10000;
134 RunTest<4, armnn::DataType::Float32>(0,
135 {{
"InputLayer", { 0.00000001f, 0.00000002f, 0.00000003f }}},
136 {{
"OutputLayer",{ 0.00000001f * approxInvL2Norm,
137 0.00000002f * approxInvL2Norm,
138 0.00000003f * approxInvL2Norm }}});
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_FIXTURE_TEST_CASE(L2NormalizationFloat32, L2NormFixture)