From add078b7f9a658d52ee6e8fe6771ea0517c07674 Mon Sep 17 00:00:00 2001 From: mathad01 Date: Mon, 10 May 2021 16:51:20 +0100 Subject: IVGCVSW-5908 Update 21.05 Doxygen Documents Signed-off-by: mathad01 Change-Id: I95316d4fc5f9d10185492dc835bb2411c1daea7b --- 21.05/_permute_as_reshape_tests_8cpp_source.xhtml | 137 ++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 21.05/_permute_as_reshape_tests_8cpp_source.xhtml (limited to '21.05/_permute_as_reshape_tests_8cpp_source.xhtml') diff --git a/21.05/_permute_as_reshape_tests_8cpp_source.xhtml b/21.05/_permute_as_reshape_tests_8cpp_source.xhtml new file mode 100644 index 0000000000..109ba3a6f9 --- /dev/null +++ b/21.05/_permute_as_reshape_tests_8cpp_source.xhtml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/test/optimizations/PermuteAsReshapeTests.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
PermuteAsReshapeTests.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "../TestUtils.hpp"
7 
8 #include <Optimizer.hpp>
9 
10 #include <boost/test/unit_test.hpp>
11 
12 using namespace armnn;
13 
15 using namespace armnn::optimizations;
16 
17 BOOST_AUTO_TEST_CASE(PermuteAsReshapeTest)
18 {
19  armnn::Graph graph;
20 
21  std::string permuteLayerName = "permute";
22 
23  const armnn::TensorInfo infoIn({ 1, 2, 3, 1 }, armnn::DataType::Float32);
24  const armnn::TensorInfo infoOut({ 1, 1, 2, 3 }, armnn::DataType::Float32);
25 
26  auto output = graph.AddLayer<armnn::OutputLayer>(0, "output");
27 
28  graph.InsertNewLayer<armnn::InputLayer>(output->GetInputSlot(0), 0, "input")
29  ->GetOutputHandler()
30  .SetTensorInfo(infoIn);
31 
32  // Inserts permute.
33  graph
34  .InsertNewLayer<armnn::PermuteLayer>(output->GetInputSlot(0), armnn::PermuteDescriptor({ 0, 2, 3, 1 }),
35  permuteLayerName.c_str())
36  ->GetOutputHandler()
37  .SetTensorInfo(infoOut);
38 
39  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>,
40  &IsLayerOfType<armnn::PermuteLayer>, &IsLayerOfType<armnn::OutputLayer>));
41 
43 
44  // The permute is replaced by an equivalent reshape.
45 
46  auto checkReshape = [&infoOut](const armnn::Layer* const layer) -> bool {
47  const auto reshapeLayer = static_cast<const armnn::ReshapeLayer*>(layer);
48  return IsLayerOfType<armnn::ReshapeLayer>(layer) &&
49  (reshapeLayer->GetParameters().m_TargetShape == infoOut.GetShape()) &&
50  (reshapeLayer->GetOutputHandler().GetTensorInfo().GetShape() == infoOut.GetShape());
51  };
52 
53  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>, checkReshape,
54  &IsLayerOfType<armnn::OutputLayer>));
55 
56  std::list<std::string> testRelatedLayers = { permuteLayerName };
57  BOOST_TEST(CheckRelatedLayers<armnn::ReshapeLayer>(graph, testRelatedLayers));
58 }
59 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
+
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
+ + +
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
Definition: Graph.hpp:402
+
ConstIterator cbegin() const
Returns const iterator pointing to the beginning of the list. Lowercase for range-based for loops...
Definition: Graph.hpp:172
+
static void Pass(Graph &graph, const Optimizations &optimizations)
Definition: Optimizer.cpp:16
+
This layer represents a reshape operation.
+
Copyright (c) 2021 ARM Limited and Contributors.
+
This layer represents a permutation operation.
+ +
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: OutputLayer.hpp:13
+
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
+ +
OptimizeForType< PermuteLayer, PermuteAsReshapeImpl > PermuteAsReshape
+
BOOST_AUTO_TEST_SUITE_END()
+
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: InputLayer.hpp:13
+
bool CheckSequence(const armnn::Graph::ConstIterator first, const armnn::Graph::ConstIterator last)
Definition: TestUtils.hpp:21
+ +
ConstIterator cend() const
Returns const iterator pointing to the end of the list. Lowercase for range-based for loops...
Definition: Graph.hpp:174
+
LayerT * InsertNewLayer(InputSlot &insertBefore, Args &&... args)
Inserts a new layer between the output slot currently connected to insertBefore and insertBefore itse...
Definition: Graph.hpp:416
+ + +
A PermuteDescriptor for the PermuteLayer.
+
+
+ + + + -- cgit v1.2.1