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/_test_inputs_8cpp.xhtml | 168 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 20.02/_test_inputs_8cpp.xhtml (limited to '20.02/_test_inputs_8cpp.xhtml') diff --git a/20.02/_test_inputs_8cpp.xhtml b/20.02/_test_inputs_8cpp.xhtml new file mode 100644 index 0000000000..2b05618137 --- /dev/null +++ b/20.02/_test_inputs_8cpp.xhtml @@ -0,0 +1,168 @@ + + + + + + + + + + + + + +ArmNN: src/armnnCaffeParser/test/TestInputs.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.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(), armnn::Optimize(), and options.

+
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:32
+
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
+
CPU Execution: Reference C++ kernels.
+ +
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:24
+
int NetworkId
Definition: IRuntime.hpp:19
+
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:890
+
static ICaffeParserPtr Create()
+
std::unique_ptr< ICaffeParser, void(*)(ICaffeParser *parser)> ICaffeParserPtr
+ + +
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
Definition: Tensor.hpp:146
+
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:101
+
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
+
+
+
+
+
+ + + + -- cgit v1.2.1