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 --- 21.02/_test_inputs_8cpp.xhtml | 167 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 21.02/_test_inputs_8cpp.xhtml (limited to '21.02/_test_inputs_8cpp.xhtml') diff --git a/21.02/_test_inputs_8cpp.xhtml b/21.02/_test_inputs_8cpp.xhtml new file mode 100644 index 0000000000..e404dbcb60 --- /dev/null +++ b/21.02/_test_inputs_8cpp.xhtml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + +ArmNN: src/armnnCaffeParser/test/TestInputs.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
TestInputs.cpp File Reference
+
+
+
#include <boost/test/unit_test.hpp>
+#include "armnnCaffeParser/ICaffeParser.hpp"
+#include "armnn/IRuntime.hpp"
+#include "armnn/INetwork.hpp"
+#include "armnn/Exceptions.hpp"
+#include "test/TensorHelpers.hpp"
+#include <string>
+#include "ParserPrototxtFixture.hpp"
+
+

Go to the source code of this file.

+ + + + +

+Functions

 BOOST_AUTO_TEST_CASE (InputShapes)
 
+

Function Documentation

+ +

◆ BOOST_AUTO_TEST_CASE()

+ +
+
+ + + + + + + + +
BOOST_AUTO_TEST_CASE (InputShapes )
+
+ +

Definition at line 20 of file TestInputs.cpp.

+ +

References BOOST_AUTO_TEST_SUITE_END(), armnn::CpuRef, ICaffeParser::Create(), IRuntime::Create(), TensorInfo::GetShape(), and armnn::Optimize().

+
21 {
22  std::string explicitInput = "name: \"Minimal\"\n"
23  "layer {\n"
24  " name: \"data\"\n"
25  " type: \"Input\"\n"
26  " top: \"data\"\n"
27  " input_param { shape: { dim: 1 dim: 2 dim: 3 dim: 4 } }\n"
28  "}";
29  std::string implicitInput = "name: \"Minimal\"\n"
30  "input: \"data\" \n"
31  "input_dim: 1 \n"
32  "input_dim: 2 \n"
33  "input_dim: 3 \n"
34  "input_dim: 4 \n";
35  std::string implicitInputNoShape = "name: \"Minimal\"\n"
36  "input: \"data\" \n";
37 
41  armnn::INetworkPtr network(nullptr, nullptr);
42  armnn::NetworkId netId;
43 
44  // Check everything works normally
45  std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
46  {
47  network = parser->CreateNetworkFromString(explicitInput.c_str(), {}, { "data" });
48  BOOST_TEST(network.get());
49  runtime->LoadNetwork(netId, Optimize(*network, backends, runtime->GetDeviceSpec()));
50 
51  armnnCaffeParser::BindingPointInfo inputBindingInfo = parser->GetNetworkInputBindingInfo("data");
52  armnn::TensorInfo inputTensorInfo = inputBindingInfo.second;
53  BOOST_TEST((inputTensorInfo == runtime->GetInputTensorInfo(netId, inputBindingInfo.first)));
54 
55  BOOST_TEST(inputTensorInfo.GetShape()[0] == 1);
56  BOOST_TEST(inputTensorInfo.GetShape()[1] == 2);
57  BOOST_TEST(inputTensorInfo.GetShape()[2] == 3);
58  BOOST_TEST(inputTensorInfo.GetShape()[3] == 4);
59  }
60 
61  // Checks everything works with implicit input.
62  {
63  network = parser->CreateNetworkFromString(implicitInput.c_str(), {}, { "data" });
64  BOOST_TEST(network.get());
65  runtime->LoadNetwork(netId, Optimize(*network, backends, runtime->GetDeviceSpec()));
66 
67  armnnCaffeParser::BindingPointInfo inputBindingInfo = parser->GetNetworkInputBindingInfo("data");
68  armnn::TensorInfo inputTensorInfo = inputBindingInfo.second;
69  BOOST_TEST((inputTensorInfo == runtime->GetInputTensorInfo(netId, inputBindingInfo.first)));
70 
71  BOOST_TEST(inputTensorInfo.GetShape()[0] == 1);
72  BOOST_TEST(inputTensorInfo.GetShape()[1] == 2);
73  BOOST_TEST(inputTensorInfo.GetShape()[2] == 3);
74  BOOST_TEST(inputTensorInfo.GetShape()[3] == 4);
75  }
76 
77  // Checks everything works with implicit and passing shape.
78  {
79  network = parser->CreateNetworkFromString(implicitInput.c_str(), { {"data", { 2, 2, 3, 4 } } }, { "data" });
80  BOOST_TEST(network.get());
81  runtime->LoadNetwork(netId, Optimize(*network, backends, runtime->GetDeviceSpec()));
82 
83  armnnCaffeParser::BindingPointInfo inputBindingInfo = parser->GetNetworkInputBindingInfo("data");
84  armnn::TensorInfo inputTensorInfo = inputBindingInfo.second;
85  BOOST_TEST((inputTensorInfo == runtime->GetInputTensorInfo(netId, inputBindingInfo.first)));
86 
87  BOOST_TEST(inputTensorInfo.GetShape()[0] == 2);
88  BOOST_TEST(inputTensorInfo.GetShape()[1] == 2);
89  BOOST_TEST(inputTensorInfo.GetShape()[2] == 3);
90  BOOST_TEST(inputTensorInfo.GetShape()[3] == 4);
91  }
92 
93  // Checks everything works with implicit (no shape) and passing shape.
94  {
95  network = parser->CreateNetworkFromString(implicitInputNoShape.c_str(), {{"data", {2, 2, 3, 4} }}, { "data" });
96  BOOST_TEST(network.get());
97  runtime->LoadNetwork(netId, Optimize(*network, backends, runtime->GetDeviceSpec()));
98 
99  armnnCaffeParser::BindingPointInfo inputBindingInfo = parser->GetNetworkInputBindingInfo("data");
100  armnn::TensorInfo inputTensorInfo = inputBindingInfo.second;
101  BOOST_TEST((inputTensorInfo == runtime->GetInputTensorInfo(netId, inputBindingInfo.first)));
102 
103  BOOST_TEST(inputTensorInfo.GetShape()[0] == 2);
104  BOOST_TEST(inputTensorInfo.GetShape()[1] == 2);
105  BOOST_TEST(inputTensorInfo.GetShape()[2] == 3);
106  BOOST_TEST(inputTensorInfo.GetShape()[3] == 4);
107  }
108 
109  // Checks exception on incompatible shapes.
110  {
111  BOOST_CHECK_THROW(parser->CreateNetworkFromString(implicitInput.c_str(), {{"data",{ 2, 2, 3, 2 }}}, {"data"}),
113  }
114 
115  // Checks exception when no shape available.
116  {
117  BOOST_CHECK_THROW(parser->CreateNetworkFromString(implicitInputNoShape.c_str(), {}, { "data" }),
119  }
120 }
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:37
+
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
+
CPU Execution: Reference C++ kernels.
+ +
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
+
int NetworkId
Definition: IRuntime.hpp:20
+
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
Definition: Network.cpp:1502
+
static ICaffeParserPtr Create()
Definition: CaffeParser.cpp:75
+
std::unique_ptr< ICaffeParser, void(*)(ICaffeParser *parser)> ICaffeParserPtr
+ + +
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
Definition: Tensor.hpp:261
+
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173
+
+
+
+
+
+ + + + -- cgit v1.2.1