From 549b9600a6eaf0727fa084465a75f173edf8f381 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Tue, 24 May 2022 11:32:07 +0100 Subject: Update 22.05 Doxygen Docs after updates to main Readme Signed-off-by: Nikhil Raj Change-Id: I56711772406a41ff81fa136a5fb6c59c9b9cf504 --- .../_transpose_as_reshape_tests_8cpp_source.xhtml | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 22.05/_transpose_as_reshape_tests_8cpp_source.xhtml (limited to '22.05/_transpose_as_reshape_tests_8cpp_source.xhtml') diff --git a/22.05/_transpose_as_reshape_tests_8cpp_source.xhtml b/22.05/_transpose_as_reshape_tests_8cpp_source.xhtml new file mode 100644 index 0000000000..a687143ecf --- /dev/null +++ b/22.05/_transpose_as_reshape_tests_8cpp_source.xhtml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/test/optimizations/TransposeAsReshapeTests.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  22.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
TransposeAsReshapeTests.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <TestUtils.hpp>
7 
8 #include <Optimizer.hpp>
9 
10 #include <doctest/doctest.h>
11 
12 using namespace armnn;
13 
14 TEST_SUITE("Optimizer")
15 {
16 using namespace armnn::optimizations;
17 
18 TEST_CASE("TransposeAsReshapeTest")
19 {
20  armnn::Graph graph;
21 
22  std::string transposeLayerName = "transpose";
23 
24  const armnn::TensorInfo infoIn({ 1, 2, 3, 1 }, armnn::DataType::Float32);
25  const armnn::TensorInfo infoOut({ 1, 1, 2, 3 }, armnn::DataType::Float32);
26 
27  auto output = graph.AddLayer<armnn::OutputLayer>(0, "output");
28 
29  graph.InsertNewLayer<armnn::InputLayer>(output->GetInputSlot(0), 0, "input")
30  ->GetOutputHandler()
31  .SetTensorInfo(infoIn);
32 
33  // Inserts transpose.
34  graph
35  .InsertNewLayer<armnn::TransposeLayer>(output->GetInputSlot(0), armnn::TransposeDescriptor({ 0, 3, 1, 2 }),
36  transposeLayerName.c_str())
37  ->GetOutputHandler()
38  .SetTensorInfo(infoOut);
39 
40  CHECK(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>,
41  &IsLayerOfType<armnn::TransposeLayer>, &IsLayerOfType<armnn::OutputLayer>));
42 
44 
45  // The transpose is replaced by an equivalent reshape.
46 
47  auto checkReshape = [&infoOut](const armnn::Layer* const layer) -> bool {
48  const auto reshapeLayer = static_cast<const armnn::ReshapeLayer*>(layer);
49  return IsLayerOfType<armnn::ReshapeLayer>(layer) &&
50  (reshapeLayer->GetParameters().m_TargetShape == infoOut.GetShape()) &&
51  (reshapeLayer->GetOutputHandler().GetTensorInfo().GetShape() == infoOut.GetShape());
52  };
53 
54  CHECK(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<armnn::InputLayer>, checkReshape,
55  &IsLayerOfType<armnn::OutputLayer>));
56 
57  std::list<std::string> testRelatedLayers = { transposeLayerName };
58  CHECK(CheckRelatedLayers<armnn::ReshapeLayer>(graph, testRelatedLayers));
59 }
60 
61 }
TEST_SUITE("TestConstTensorLayerVisitor")
+
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
+
bool CheckSequence(const armnn::Graph::ConstIterator first, const armnn::Graph::ConstIterator last)
Definition: TestUtils.hpp:21
+ + +
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
Definition: Graph.hpp:425
+
ConstIterator cbegin() const
Returns const iterator pointing to the beginning of the list. Lowercase for range-based for loops...
Definition: Graph.hpp:179
+
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.
+ +
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: OutputLayer.hpp:13
+
OptimizeForType< TransposeLayer, TransposeAsReshapeImpl > TransposeAsReshape
+ +
This layer represents a transpose operation.
+
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: InputLayer.hpp:13
+
A TransposeDescriptor for the TransposeLayer.
+ +
ConstIterator cend() const
Returns const iterator pointing to the end of the list. Lowercase for range-based for loops...
Definition: Graph.hpp:181
+
LayerT * InsertNewLayer(InputSlot &insertBefore, Args &&... args)
Inserts a new layer between the output slot currently connected to insertBefore and insertBefore itse...
Definition: Graph.hpp:440
+ +
+
+ + + + -- cgit v1.2.1