From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- ...armnn_tf_lite_parser_2test_2_conv2_d_8cpp.xhtml | 288 +++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 20.02/armnn_tf_lite_parser_2test_2_conv2_d_8cpp.xhtml (limited to '20.02/armnn_tf_lite_parser_2test_2_conv2_d_8cpp.xhtml') diff --git a/20.02/armnn_tf_lite_parser_2test_2_conv2_d_8cpp.xhtml b/20.02/armnn_tf_lite_parser_2test_2_conv2_d_8cpp.xhtml new file mode 100644 index 0000000000..8a4ef86183 --- /dev/null +++ b/20.02/armnn_tf_lite_parser_2test_2_conv2_d_8cpp.xhtml @@ -0,0 +1,288 @@ + + + + + + + + + + + + + +ArmNN: src/armnnTfLiteParser/test/Conv2D.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Conv2D.cpp File Reference
+
+
+
#include <boost/test/unit_test.hpp>
+#include "ParserFlatbuffersFixture.hpp"
+#include "../TfLiteParser.hpp"
+#include <sstream>
+
+

Go to the source code of this file.

+ + + + + + + + + + + + +

+Functions

 BOOST_FIXTURE_TEST_CASE (ParseSimpleConv2D, SimpleConv2DFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2DWithBias, SimpleConv2DWithBiasesFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2D_112x112_out, Conv2DShapeTestFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2DAndReluWithBias, ReluConv2DWithBiasesFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseConv2DAndRelu6WithBias, Relu6Conv2DWithBiasesFixture)
 
+

Function Documentation

+ +

◆ BOOST_FIXTURE_TEST_CASE() [1/5]

+ +
+
+ + + + + + + + + + + + + + + + + + +
BOOST_FIXTURE_TEST_CASE (ParseSimpleConv2D ,
SimpleConv2DFixture  
)
+
+ +

Definition at line 90 of file Conv2D.cpp.

+
91 {
92  RunTest<4, armnn::DataType::QAsymmU8>(
93  0,
94  {
95  1, 2, 3,
96  4, 5, 6,
97  7, 8, 9,
98  },
99  // because of the output scaling we need to take half of the values
100  {
101  (1*2 + 2*1 + 3*0 +
102  4*6 + 5*2 + 6*1 +
103  7*4 + 8*1 + 9*2) /2
104  });
105 }
+
+
+ +

◆ BOOST_FIXTURE_TEST_CASE() [2/5]

+ +
+
+ + + + + + + + + + + + + + + + + + +
BOOST_FIXTURE_TEST_CASE (ParseConv2DWithBias ,
SimpleConv2DWithBiasesFixture  
)
+
+ +

Definition at line 220 of file Conv2D.cpp.

+
221 {
222  RunTest<4, armnn::DataType::QAsymmU8>(
223  0,
224  {
225  1, 2,
226  3, 4,
227  },
228  // because of the output scaling we need to take half of the values
229  {
230  (1*2 + 2*1 + 3*0 + 4*6 + 10)/2,
231  (2*2 + 0*1 + 4*0 + 0*6 + 10)/2,
232  (3*2 + 4*1 + 0*0 + 0*6 + 10)/2,
233  (4*2 + 0*1 + 0*0 + 0*6 + 10)/2
234  });
235 }
+
+
+ +

◆ BOOST_FIXTURE_TEST_CASE() [3/5]

+ +
+
+ + + + + + + + + + + + + + + + + + +
BOOST_FIXTURE_TEST_CASE (ParseConv2D_112x112_out ,
Conv2DShapeTestFixture  
)
+
+ +

Definition at line 265 of file Conv2D.cpp.

+
266 {
267 }
+
+
+ +

◆ BOOST_FIXTURE_TEST_CASE() [4/5]

+ +
+
+ + + + + + + + + + + + + + + + + + +
BOOST_FIXTURE_TEST_CASE (ParseConv2DAndReluWithBias ,
ReluConv2DWithBiasesFixture  
)
+
+ +

Definition at line 287 of file Conv2D.cpp.

+
288 {
289  uint8_t bias = 16;
290  uint8_t outZero = 20;
291  uint8_t fz = 4; // filter zero point
292 
293  RunTest<4, armnn::DataType::QAsymmU8>(
294  0,
295  {
296  1, 2,
297  4, 8,
298  },
299  // factors to consider:
300  // - the filter zero point is non zero, hence the (x-fz)
301  // - the output scale is 2 hence the /2
302  // - output zero point is non zero, hence the +outZero
303  // - RELU cuts negative values and then we add the output zero point
304  {
305  std::max(outZero, static_cast<uint8_t>((1*(2-fz) + 2*(1-fz) + 4*(0-fz) + 8*(6-fz) + bias)/2 + outZero)),
306  std::max(outZero, static_cast<uint8_t>((2*(2-fz) + 0*(1-fz) + 8*(0-fz) + 0*(6-fz) + bias)/2 + outZero)),
307  std::max(outZero, static_cast<uint8_t>((4*(2-fz) + 8*(1-fz) + 0*(0-fz) + 0*(6-fz) + bias)/2 + outZero)),
308  std::max(outZero, static_cast<uint8_t>((8*(2-fz) + 0*(1-fz) + 0*(0-fz) + 0*(6-fz) + bias)/2 + outZero))
309  });
310 }
+
+
+ +

◆ BOOST_FIXTURE_TEST_CASE() [5/5]

+ +
+
+ + + + + + + + + + + + + + + + + + +
BOOST_FIXTURE_TEST_CASE (ParseConv2DAndRelu6WithBias ,
Relu6Conv2DWithBiasesFixture  
)
+
+ +

Definition at line 330 of file Conv2D.cpp.

+ +

References BOOST_AUTO_TEST_SUITE_END().

+
331 {
332  uint8_t relu6Min = 6 / 2; // divide by output scale
333 
334  RunTest<4, armnn::DataType::QAsymmU8>(
335  0,
336  {
337  1, 2,
338  4, 1,
339  },
340  // factors to consider:
341  // - the output scale is 2 hence the /2
342  // - RELU6 cuts output values at +6
343  {
344  std::min(relu6Min, static_cast<uint8_t>((1*2 + 2*1 + 4*0 + 1*6)/2)),
345  std::min(relu6Min, static_cast<uint8_t>((2*2 + 0*1 + 1*0 + 0*6)/2)),
346  std::min(relu6Min, static_cast<uint8_t>((4*2 + 1*1 + 0*0 + 0*6)/2)),
347  std::min(relu6Min, static_cast<uint8_t>((1*2 + 0*1 + 0*0 + 0*6)/2))
348  });
349 }
+
+
+
+
+ + + + -- cgit v1.2.1