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 --- 20.02/_move_permute_up_tests_8cpp.xhtml | 174 ++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 20.02/_move_permute_up_tests_8cpp.xhtml (limited to '20.02/_move_permute_up_tests_8cpp.xhtml') diff --git a/20.02/_move_permute_up_tests_8cpp.xhtml b/20.02/_move_permute_up_tests_8cpp.xhtml new file mode 100644 index 0000000000..105b60b5b0 --- /dev/null +++ b/20.02/_move_permute_up_tests_8cpp.xhtml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/test/optimizations/MovePermuteUpTests.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
MovePermuteUpTests.cpp File Reference
+
+
+
#include "../TestUtils.hpp"
+#include <Optimizer.hpp>
+#include <boost/test/unit_test.hpp>
+
+

Go to the source code of this file.

+ + + + +

+Functions

 BOOST_AUTO_TEST_CASE (MovePermuteUpTest)
 
+

Function Documentation

+ +

◆ BOOST_AUTO_TEST_CASE()

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (MovePermuteUpTest )
+
+ +

Definition at line 15 of file MovePermuteUpTests.cpp.

+ +

References BOOST_AUTO_TEST_SUITE_END(), CheckSequence(), armnn::Float32, Layer::GetInputSlot(), Layer::GetOutputHandler(), armnn::MakeOptimizations(), Optimizer::Pass(), and OutputHandler::SetTensorInfo().

+
16 {
17  const armnn::TensorInfo info({ 1, 5, 2, 3 }, armnn::DataType::Float32);
18  const armnn::TensorInfo permuted({ 1, 3, 5, 2 }, armnn::DataType::Float32);
19 
20  armnn::Graph graph;
21 
22  armnn::LayerBindingId inputId = 0;
23 
24  armnn::Layer* head = graph.AddLayer<armnn::OutputLayer>(0, "output");
25 
26  std::string permuteLayerName = "original_permute";
27 
28  // Insert permute
29  head = graph.InsertNewLayer<armnn::PermuteLayer>(head->GetInputSlot(0), armnn::PermuteDescriptor({ 0, 2, 3, 1 }),
30  permuteLayerName.c_str());
31 
32  head->GetOutputHandler().SetTensorInfo(permuted);
33 
34  // Inserts layers that don't care about data format.
35  head = graph.InsertNewLayer<armnn::ActivationLayer>(head->GetInputSlot(0), armnn::ActivationDescriptor{}, "");
36  head->GetOutputHandler().SetTensorInfo(info);
37 
38  head = graph.InsertNewLayer<armnn::AdditionLayer>(head->GetInputSlot(0), "");
39  head->GetOutputHandler().SetTensorInfo(info);
40 
41  // Inserts input for 2nd input of Addition.
42  graph.InsertNewLayer<armnn::InputLayer>(head->GetInputSlot(1), inputId++, "")
43  ->GetOutputHandler()
44  .SetTensorInfo(info);
45 
46  head = graph.InsertNewLayer<armnn::FakeQuantizationLayer>(head->GetInputSlot(0),
48  head->GetOutputHandler().SetTensorInfo(info);
49 
50  head = graph.InsertNewLayer<armnn::FloorLayer>(head->GetInputSlot(0), "");
51  head->GetOutputHandler().SetTensorInfo(info);
52 
53  head = graph.InsertNewLayer<armnn::MemCopyLayer>(head->GetInputSlot(0), "");
54  head->GetOutputHandler().SetTensorInfo(info);
55 
56  head = graph.InsertNewLayer<armnn::MultiplicationLayer>(head->GetInputSlot(0), "");
57  head->GetOutputHandler().SetTensorInfo(info);
58 
59  // Inserts input for 2nd input of Multiplication.
60  graph.InsertNewLayer<armnn::InputLayer>(head->GetInputSlot(1), inputId++, "")
61  ->GetOutputHandler()
62  .SetTensorInfo(info);
63 
64  // Inserts input.
65  graph.InsertNewLayer<armnn::InputLayer>(head->GetInputSlot(0), inputId++, "")
66  ->GetOutputHandler()
67  .SetTensorInfo(info);
68 
69  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>,
70  &IsLayerOfType<armnn::InputLayer>, &IsLayerOfType<armnn::InputLayer>,
71  &IsLayerOfType<armnn::MultiplicationLayer>, &IsLayerOfType<armnn::MemCopyLayer>,
72  &IsLayerOfType<armnn::FloorLayer>, &IsLayerOfType<armnn::FakeQuantizationLayer>,
73  &IsLayerOfType<armnn::AdditionLayer>, &IsLayerOfType<armnn::ActivationLayer>,
74  &IsLayerOfType<armnn::PermuteLayer>, &IsLayerOfType<armnn::OutputLayer>));
75 
77 
78  // The permute is moved to the top. New permutes for layers with multiple inputs.
79  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>,
80  &IsLayerOfType<armnn::InputLayer>, &IsLayerOfType<armnn::InputLayer>,
81  &IsLayerOfType<armnn::PermuteLayer>, &IsLayerOfType<armnn::PermuteLayer>,
82  &IsLayerOfType<armnn::PermuteLayer>, &IsLayerOfType<armnn::MultiplicationLayer>,
83  &IsLayerOfType<armnn::MemCopyLayer>, &IsLayerOfType<armnn::FloorLayer>,
84  &IsLayerOfType<armnn::FakeQuantizationLayer>, &IsLayerOfType<armnn::AdditionLayer>,
85  &IsLayerOfType<armnn::ActivationLayer>, &IsLayerOfType<armnn::OutputLayer>));
86 
87  std::list<std::string> testRelatedLayers = { permuteLayerName };
88 
89  BOOST_TEST(CheckRelatedLayers<armnn::PermuteLayer>(graph, testRelatedLayers));
90 }
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
+ +
static void Pass(Graph &graph, const Optimizations &optimizations)
Definition: Optimizer.cpp:16
+
This layer represents an activation operation with the specified activation function.
+
This layer represents a permutation operation.
+
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:171
+
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:310
+
OptimizeForConnection< Layer, PermuteLayer, MovePermuteUpImpl > MovePermuteUp
+
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: OutputLayer.hpp:13
+
A FakeQuantizationDescriptor for the FakeQuantizationLayer.
+
This layer represents a memory copy operation.
+
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:20
+
This layer represents a fake quantization operation.
+
This layer represents a floor operation.
Definition: FloorLayer.hpp:13
+ +
This layer represents an addition operation.
+
void SetTensorInfo(const TensorInfo &tensorInfo)
Sets the TensorInfo used by this output handler.
+ +
const OutputHandler & GetOutputHandler(unsigned int i=0) const
Definition: Layer.hpp:221
+
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:20
+ +
This layer represents a multiplication operation.
+ +
A PermuteDescriptor for the PermuteLayer.
+
+
+
+
+
+ + + + -- cgit v1.2.1