From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- ...tch_to_space_as_depth_to_space_tests_8cpp.xhtml | 206 +++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 21.02/_permute_and_batch_to_space_as_depth_to_space_tests_8cpp.xhtml (limited to '21.02/_permute_and_batch_to_space_as_depth_to_space_tests_8cpp.xhtml') diff --git a/21.02/_permute_and_batch_to_space_as_depth_to_space_tests_8cpp.xhtml b/21.02/_permute_and_batch_to_space_as_depth_to_space_tests_8cpp.xhtml new file mode 100644 index 0000000000..6e0b562987 --- /dev/null +++ b/21.02/_permute_and_batch_to_space_as_depth_to_space_tests_8cpp.xhtml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp File Reference
+
+
+
#include "../TestUtils.hpp"
+#include <Network.hpp>
+#include <Optimizer.hpp>
+#include <boost/test/unit_test.hpp>
+
+

Go to the source code of this file.

+ + + + + + + + +

+Functions

 BOOST_AUTO_TEST_CASE (PermuteAndBatchToSpaceAsDepthToSpaceOptimizerTest)
 Tests that the optimization performed by PermuteAndBatchToSpaceAsDepthToSpace is as expected. More...
 
 BOOST_AUTO_TEST_CASE (TransposeAndBatchToSpaceAsDepthToSpaceOptimizerTest)
 Tests that the optimization performed by PermuteAndBatchToSpaceAsDepthToSpace is as expected. More...
 
+

Function Documentation

+ +

◆ BOOST_AUTO_TEST_CASE() [1/2]

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (PermuteAndBatchToSpaceAsDepthToSpaceOptimizerTest )
+
+ +

Tests that the optimization performed by PermuteAndBatchToSpaceAsDepthToSpace is as expected.

+

Note this does not ensure the correctness of the optimization - that is done in the below test.

+ +

Definition at line 86 of file PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp.

+ +

References Graph::cbegin(), Graph::cend(), CheckSequence(), armnn::Float32, armnn::MakeOptimizations(), armnn::NHWC, and Optimizer::Pass().

+
87 {
88  std::unique_ptr<NetworkImpl> network = CreateTestNetworkImpl();
89  Graph graph = network.get()->GetGraph();
90 
91  // Confirm initial graph is as we expect
92  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<InputLayer>, &IsLayerOfType<PermuteLayer>,
93  &IsLayerOfType<BatchToSpaceNdLayer>, &IsLayerOfType<OutputLayer>));
94 
95  // Perform the optimization which should merge the two layers into a DepthToSpace
97 
98  // Check that the replacement has been made as expected
99  auto checkDepthToSpace = [](const Layer* const layer) -> bool {
100  return IsLayerOfType<DepthToSpaceLayer>(layer) &&
101  static_cast<const DepthToSpaceLayer*>(layer)->GetParameters().m_BlockSize == 2 &&
102  static_cast<const DepthToSpaceLayer*>(layer)->GetParameters().m_DataLayout == DataLayout::NHWC &&
103  layer->GetOutputHandler().GetTensorInfo() == TensorInfo({ 1, 4, 6, 1 }, DataType::Float32);
104  };
105 
106  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<InputLayer>, checkDepthToSpace,
107  &IsLayerOfType<OutputLayer>));
108 
109  // Check the new layer has the two merged layers listed as related layers
110  std::list<std::string> testRelatedLayers = { "batchToSpace", "permute" };
111  BOOST_TEST(CheckRelatedLayers<DepthToSpaceLayer>(graph, testRelatedLayers));
112 }
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
+ +
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
+
OptimizeForConnection< PermuteLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteLayer > > PermuteAndBatchToSpaceAsDepthToSpace
+ +
const OutputHandler & GetOutputHandler(unsigned int i=0) const
Definition: Layer.hpp:225
+
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
+ +
This layer represents a DepthToSpace operation.
+
const TensorInfo & GetTensorInfo() const
Gets the matching TensorInfo for the output.
+
+
+
+ +

◆ BOOST_AUTO_TEST_CASE() [2/2]

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (TransposeAndBatchToSpaceAsDepthToSpaceOptimizerTest )
+
+ +

Tests that the optimization performed by PermuteAndBatchToSpaceAsDepthToSpace is as expected.

+

Note this does not ensure the correctness of the optimization - that is done in the below test.

+ +

Definition at line 116 of file PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp.

+ +

References armnn::BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_SUITE_END(), Graph::cbegin(), Graph::cend(), CheckSequence(), armnn::CpuRef, IRuntime::Create(), INetwork::Create(), armnn::Float32, armnn::GetGraphForTesting(), BatchToSpaceNdDescriptor::m_BlockShape, BatchToSpaceNdDescriptor::m_DataLayout, armnn::MakeOptimizations(), armnn::NHWC, armnn::Optimize(), and Optimizer::Pass().

+
117 {
118  std::unique_ptr<NetworkImpl> network = CreateTransposeTestNetworkImpl();
119  Graph graph = network.get()->GetGraph();
120 
121  // Confirm initial graph is as we expect
122  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<InputLayer>, &IsLayerOfType<TransposeLayer>,
123  &IsLayerOfType<BatchToSpaceNdLayer>, &IsLayerOfType<OutputLayer>));
124 
125  // Perform the optimization which should merge the two layers into a DepthToSpace
127 
128  // Check that the replacement has been made as expected
129  auto checkDepthToSpace = [](const Layer* const layer) -> bool {
130  return IsLayerOfType<DepthToSpaceLayer>(layer) &&
131  static_cast<const DepthToSpaceLayer*>(layer)->GetParameters().m_BlockSize == 2 &&
132  static_cast<const DepthToSpaceLayer*>(layer)->GetParameters().m_DataLayout == DataLayout::NHWC &&
133  layer->GetOutputHandler().GetTensorInfo() == TensorInfo({ 1, 4, 6, 1 }, DataType::Float32);
134  };
135 
136  BOOST_TEST(CheckSequence(graph.cbegin(), graph.cend(), &IsLayerOfType<InputLayer>, checkDepthToSpace,
137  &IsLayerOfType<OutputLayer>));
138 
139  // Check the new layer has the two merged layers listed as related layers
140  std::list<std::string> testRelatedLayers = { "batchToSpace", "permute" };
141  BOOST_TEST(CheckRelatedLayers<DepthToSpaceLayer>(graph, testRelatedLayers));
142 }
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
+
OptimizeForConnection< TransposeLayer, BatchToSpaceNdLayer, PermuteAndBatchToSpaceAsDepthToSpaceImpl< TransposeLayer > > TransposeAndBatchToSpaceAsDepthToSpace
+ +
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
+ +
const OutputHandler & GetOutputHandler(unsigned int i=0) const
Definition: Layer.hpp:225
+
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
+ +
This layer represents a DepthToSpace operation.
+
const TensorInfo & GetTensorInfo() const
Gets the matching TensorInfo for the output.
+
+
+
+
+
+ + + + -- cgit v1.2.1