aboutsummaryrefslogtreecommitdiff
path: root/23.05/_async_execution_sample_8cpp-example.xhtml
blob: 1028e822d8a7f6470deb2497d1643984b3ec9a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!-- Copyright (c) 2020 ARM Limited. -->
<!--                                 -->
<!-- SPDX-License-Identifier: MIT    -->
<!--                                 -->
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ArmNN: AsyncExecutionSample.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 10rem; margin-top: .5rem; margin-left 10px"/>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">23.05</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_async_execution_sample_8cpp-example.xhtml',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">AsyncExecutionSample.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>Yet another variant of the SimpleSample application. In this little sample app you will be shown how to run a network multiple times asynchronously.</p>
<dl class="section note"><dt>Note</dt><dd>This is currently an experimental interface</dd></dl>
<div class="fragment"><div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.</span></div>
<div class="line"><span class="comment">// SPDX-License-Identifier: MIT</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="_i_network_8hpp.xhtml">armnn/INetwork.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="_i_runtime_8hpp.xhtml">armnn/IRuntime.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="_utils_8hpp.xhtml">armnn/Utils.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="_descriptors_8hpp.xhtml">armnn/Descriptors.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment">/// A simple example of using the ArmNN SDK API to run a network multiple times with different inputs in an asynchronous</span></div>
<div class="line"><span class="comment">/// manner.</span></div>
<div class="line"><span class="comment">///</span></div>
<div class="line"><span class="comment">/// Background info: The usual runtime-&gt;EnqueueWorkload, which is used to trigger the execution of a network, is not</span></div>
<div class="line"><span class="comment">///                  thread safe. Each workload has memory assigned to it which would be overwritten by each thread.</span></div>
<div class="line"><span class="comment">///                  Before we added support for this you had to load a network multiple times to execute it at the</span></div>
<div class="line"><span class="comment">///                  same time. Every time a network is loaded, it takes up memory on your device. Making the</span></div>
<div class="line"><span class="comment">///                  execution thread safe helps to reduce the memory footprint for concurrent executions significantly.</span></div>
<div class="line"><span class="comment">///                  This example shows you how to execute a model concurrently (multiple threads) while still only</span></div>
<div class="line"><span class="comment">///                  loading it once.</span></div>
<div class="line"><span class="comment">///</span></div>
<div class="line"><span class="comment">/// As in most of our simple samples, the network in this example will ask the user for a single input number for each</span></div>
<div class="line"><span class="comment">/// execution of the network.</span></div>
<div class="line"><span class="comment">/// The network consists of a single fully connected layer with a single neuron. The neurons weight is set to 1.0f</span></div>
<div class="line"><span class="comment">/// to produce an output number that is the same as the input.</span></div>
<div class="line"><span class="comment"></span><span class="keywordtype">int</span> <a name="a0"></a><a class="code" href="_armnn_converter_8cpp.xhtml#a0ddf1224851353fc92bfbff6f499fa97">main</a>()</div>
<div class="line">{</div>
<div class="line">    <span class="keyword">using namespace </span><a class="code" href="namespacearmnn.xhtml">armnn</a>;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// The first part of this code is very similar to the SimpleSample.cpp you should check it out for comparison</span></div>
<div class="line">    <span class="comment">// The interesting part starts when the graph is loaded into the runtime</span></div>
<div class="line"> </div>
<div class="line">    std::vector&lt;float&gt; inputs;</div>
<div class="line">    <span class="keywordtype">float</span> number1;</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Please enter a number for the first iteration: &quot;</span> &lt;&lt; std::endl;</div>
<div class="line">    std::cin &gt;&gt; number1;</div>
<div class="line">    <span class="keywordtype">float</span> number2;</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Please enter a number for the second iteration: &quot;</span> &lt;&lt; std::endl;</div>
<div class="line">    std::cin &gt;&gt; number2;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Turn on logging to standard output</span></div>
<div class="line">    <span class="comment">// This is useful in this sample so that users can learn more about what is going on</span></div>
<div class="line">    <a name="a1"></a><a class="code" href="namespacearmnn.xhtml#aa59f7a819c3e29d10ffc41e5c0616872">ConfigureLogging</a>(<span class="keyword">true</span>, <span class="keyword">false</span>, <a name="a2"></a><a class="code" href="namespacearmnn.xhtml#a93a3ba385cad27c4774e5fe64c025d3da0eaadb4fcb48a0a0ed7bc9868be9fbaa">LogSeverity::Warning</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Construct ArmNN network</span></div>
<div class="line">    <a class="code" href="namespacearmnn.xhtml#a0d8160388a127c1a23b37bc88dc6e2ec">NetworkId</a> networkIdentifier;</div>
<div class="line">    <a class="code" href="namespacearmnn.xhtml#ace74f6f9feb95a964a49d79458232703">INetworkPtr</a> myNetwork = <a name="a3"></a><a class="code" href="classarmnn_1_1_i_network.xhtml#a41ce159095e95f7cd4174ce5d4662697">INetwork::Create</a>();</div>
<div class="line"> </div>
<div class="line">    <span class="keywordtype">float</span> weightsData[] = {1.0f}; <span class="comment">// Identity</span></div>
<div class="line">    <a name="_a4"></a><a class="code" href="classarmnn_1_1_tensor_info.xhtml">TensorInfo</a> weightsInfo(<a name="_a5"></a><a class="code" href="classarmnn_1_1_tensor_shape.xhtml">TensorShape</a>({1, 1}), <a name="a6"></a><a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">DataType::Float32</a>, 0.0f, 0, <span class="keyword">true</span>);</div>
<div class="line">    weightsInfo.<a name="a7"></a><a class="code" href="classarmnn_1_1_tensor_info.xhtml#a8ffca1e21bdfa7f945617acd606aac91">SetConstant</a>();</div>
<div class="line">    <a name="_a8"></a><a class="code" href="classarmnn_1_1_const_tensor.xhtml">ConstTensor</a> weights(weightsInfo, weightsData);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Constant layer that now holds weights data for FullyConnected</span></div>
<div class="line">    <a name="_a9"></a><a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml">IConnectableLayer</a>* <span class="keyword">const</span> constantWeightsLayer = myNetwork-&gt;AddConstantLayer(weights, <span class="stringliteral">&quot;const weights&quot;</span>);</div>
<div class="line"> </div>
<div class="line">    <a name="_a10"></a><a class="code" href="structarmnn_1_1_fully_connected_descriptor.xhtml">FullyConnectedDescriptor</a> fullyConnectedDesc;</div>
<div class="line">    <a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml">IConnectableLayer</a>* <span class="keyword">const</span> fullyConnectedLayer = myNetwork-&gt;AddFullyConnectedLayer(fullyConnectedDesc,</div>
<div class="line">                                                                                     <span class="stringliteral">&quot;fully connected&quot;</span>);</div>
<div class="line">    <a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml">IConnectableLayer</a>* <a name="_a11"></a><a class="code" href="classarmnn_1_1_input_layer.xhtml">InputLayer</a>  = myNetwork-&gt;AddInputLayer(0);</div>
<div class="line">    <a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml">IConnectableLayer</a>* <a name="_a12"></a><a class="code" href="classarmnn_1_1_output_layer.xhtml">OutputLayer</a> = myNetwork-&gt;AddOutputLayer(0);</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="classarmnn_1_1_input_layer.xhtml">InputLayer</a>-&gt;<a name="a13"></a><a class="code" href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">GetOutputSlot</a>(0).<a name="a14"></a><a class="code" href="classarmnn_1_1_output_slot.xhtml#adcfb97035799ea4c043f9ef370714815">Connect</a>(fullyConnectedLayer-&gt;<a name="a15"></a><a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml#a6ec9e0eb66d7d6a01240492a0b18104c">GetInputSlot</a>(0));</div>
<div class="line">    constantWeightsLayer-&gt;<a name="a16"></a><a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml#a80ac4eda2e7f2757ec9dd96fc96dbd16">GetOutputSlot</a>(0).<a name="a17"></a><a class="code" href="classarmnn_1_1_i_output_slot.xhtml#ac1835f8756a9f03c02fcf9664e3a0fce">Connect</a>(fullyConnectedLayer-&gt;<a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml#a6ec9e0eb66d7d6a01240492a0b18104c">GetInputSlot</a>(1));</div>
<div class="line">    fullyConnectedLayer-&gt;<a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml#a80ac4eda2e7f2757ec9dd96fc96dbd16">GetOutputSlot</a>(0).<a class="code" href="classarmnn_1_1_i_output_slot.xhtml#ac1835f8756a9f03c02fcf9664e3a0fce">Connect</a>(<a class="code" href="classarmnn_1_1_output_layer.xhtml">OutputLayer</a>-&gt;<a name="a18"></a><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0));</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Create ArmNN runtime</span></div>
<div class="line">    <a name="_a19"></a><a class="code" href="structarmnn_1_1_i_runtime_1_1_creation_options.xhtml">IRuntime::CreationOptions</a> options; <span class="comment">// default options</span></div>
<div class="line">    <a class="code" href="namespacearmnn.xhtml#a150468a02bd7b2d2d061c4aaaee939f0">IRuntimePtr</a> run = <a name="a20"></a><a class="code" href="classarmnn_1_1_i_runtime.xhtml#ad44ecd3700748dc30dc4bbe34ba5bde7">IRuntime::Create</a>(options);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">//Set the tensors in the network.</span></div>
<div class="line">    <a class="code" href="classarmnn_1_1_tensor_info.xhtml">TensorInfo</a> inputTensorInfo(<a class="code" href="classarmnn_1_1_tensor_shape.xhtml">TensorShape</a>({1, 1}), <a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">DataType::Float32</a>);</div>
<div class="line">    <a class="code" href="classarmnn_1_1_input_layer.xhtml">InputLayer</a>-&gt;<a class="code" href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">GetOutputSlot</a>(0).<a name="a21"></a><a class="code" href="classarmnn_1_1_output_slot.xhtml#a7e5c5771d741dd5473989047a9314728">SetTensorInfo</a>(inputTensorInfo);</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="classarmnn_1_1_tensor_info.xhtml">TensorInfo</a> outputTensorInfo(<a class="code" href="classarmnn_1_1_tensor_shape.xhtml">TensorShape</a>({1, 1}), <a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">DataType::Float32</a>);</div>
<div class="line">    fullyConnectedLayer-&gt;<a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml#a80ac4eda2e7f2757ec9dd96fc96dbd16">GetOutputSlot</a>(0).<a name="a22"></a><a class="code" href="classarmnn_1_1_i_output_slot.xhtml#a5ee4a6c9a2481245487b1b1a70d20fd0">SetTensorInfo</a>(outputTensorInfo);</div>
<div class="line">    constantWeightsLayer-&gt;<a class="code" href="classarmnn_1_1_i_connectable_layer.xhtml#a80ac4eda2e7f2757ec9dd96fc96dbd16">GetOutputSlot</a>(0).<a class="code" href="classarmnn_1_1_i_output_slot.xhtml#a5ee4a6c9a2481245487b1b1a70d20fd0">SetTensorInfo</a>(weightsInfo);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Optimise ArmNN network</span></div>
<div class="line">    <a class="code" href="namespacearmnn.xhtml#a674efcf6cbdb9e831d653ff0e821fb38">IOptimizedNetworkPtr</a> optNet = <a name="a23"></a><a class="code" href="namespacearmnn.xhtml#aa42e128b41f4e966fc901f9bf42c5a1c">Optimize</a>(*myNetwork, {<a name="a24"></a><a class="code" href="namespacearmnn.xhtml#ae2f04a162585c0a5222a537efd5456aea83c2c4e9b658ccafbcbe6309c5d84c64">Compute::CpuRef</a>}, run-&gt;GetDeviceSpec());</div>
<div class="line">    <span class="keywordflow">if</span> (!optNet)</div>
<div class="line">    {</div>
<div class="line">        <span class="comment">// This shouldn&#39;t happen for this simple sample, with reference backend.</span></div>
<div class="line">        <span class="comment">// But in general usage Optimize could fail if the hardware at runtime cannot</span></div>
<div class="line">        <span class="comment">// support the model that has been provided.</span></div>
<div class="line">        std::cerr &lt;&lt; <span class="stringliteral">&quot;Error: Failed to optimise the input network.&quot;</span> &lt;&lt; std::endl;</div>
<div class="line">        <span class="keywordflow">return</span> 1;</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Load graph into runtime.</span></div>
<div class="line">    std::string errmsg; <span class="comment">// To hold an eventual error message if loading the network fails</span></div>
<div class="line">    <span class="comment">// Add network properties to enable async execution. The MemorySource::Undefined variables indicate</span></div>
<div class="line">    <span class="comment">// that neither inputs nor outputs will be imported. Importing will be covered in another example.</span></div>
<div class="line">    <a name="_a25"></a><a class="code" href="structarmnn_1_1_i_network_properties.xhtml">armnn::INetworkProperties</a> networkProperties(<span class="keyword">true</span>, <a name="a26"></a><a class="code" href="namespacearmnn.xhtml#a14fcd7f88d11cea0a018269dca5f9277aec0fc0100c4fc1ce4eea230c3dc10360">MemorySource::Undefined</a>, <a class="code" href="namespacearmnn.xhtml#a14fcd7f88d11cea0a018269dca5f9277aec0fc0100c4fc1ce4eea230c3dc10360">MemorySource::Undefined</a>);</div>
<div class="line">    run-&gt;LoadNetwork(networkIdentifier,</div>
<div class="line">                     std::move(optNet),</div>
<div class="line">                     errmsg,</div>
<div class="line">                     networkProperties);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Creates structures for inputs and outputs. A vector of float for each execution.</span></div>
<div class="line">    std::vector&lt;std::vector&lt;float&gt;&gt; inputData{{number1}, {number2}};</div>
<div class="line">    std::vector&lt;std::vector&lt;float&gt;&gt; outputData;</div>
<div class="line">    outputData.resize(2, std::vector&lt;float&gt;(1));</div>
<div class="line"> </div>
<div class="line">    inputTensorInfo = run-&gt;GetInputTensorInfo(networkIdentifier, 0);</div>
<div class="line">    inputTensorInfo.<a class="code" href="classarmnn_1_1_tensor_info.xhtml#a8ffca1e21bdfa7f945617acd606aac91">SetConstant</a>(<span class="keyword">true</span>);</div>
<div class="line">    std::vector&lt;InputTensors&gt; inputTensors</div>
<div class="line">    {</div>
<div class="line">        {{0, <a class="code" href="classarmnn_1_1_const_tensor.xhtml">armnn::ConstTensor</a>(inputTensorInfo, inputData[0].data())}},</div>
<div class="line">        {{0, <a class="code" href="classarmnn_1_1_const_tensor.xhtml">armnn::ConstTensor</a>(inputTensorInfo, inputData[1].data())}}</div>
<div class="line">    };</div>
<div class="line">    std::vector&lt;OutputTensors&gt; outputTensors</div>
<div class="line">    {</div>
<div class="line">        {{0, <a name="_a27"></a><a class="code" href="classarmnn_1_1_tensor.xhtml">armnn::Tensor</a>(run-&gt;GetOutputTensorInfo(networkIdentifier, 0), outputData[0].data())}},</div>
<div class="line">        {{0, <a class="code" href="classarmnn_1_1_tensor.xhtml">armnn::Tensor</a>(run-&gt;GetOutputTensorInfo(networkIdentifier, 0), outputData[1].data())}}</div>
<div class="line">    };</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Lambda function to execute the network. We use it as thread function.</span></div>
<div class="line">    <span class="keyword">auto</span> execute = [&amp;](<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> executionIndex)</div>
<div class="line">    {</div>
<div class="line">        <span class="keyword">auto</span> memHandle = run-&gt;CreateWorkingMemHandle(networkIdentifier);</div>
<div class="line">        run-&gt;Execute(*memHandle, inputTensors[executionIndex], outputTensors[executionIndex]);</div>
<div class="line">    };</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Prepare some threads and let each execute the network with a different input</span></div>
<div class="line">    std::vector&lt;std::thread&gt; threads;</div>
<div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; inputTensors.size(); ++i)</div>
<div class="line">    {</div>
<div class="line">        threads.emplace_back(std::thread(execute, i));</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Wait for the threads to finish</span></div>
<div class="line">    <span class="keywordflow">for</span> (std::thread&amp; t : threads)</div>
<div class="line">    {</div>
<div class="line">        <span class="keywordflow">if</span>(t.joinable())</div>
<div class="line">        {</div>
<div class="line">            t.join();</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line"> </div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Your numbers were &quot;</span> &lt;&lt; outputData[0][0] &lt;&lt; <span class="stringliteral">&quot; and &quot;</span> &lt;&lt; outputData[1][0] &lt;&lt; std::endl;</div>
<div class="line">    <span class="keywordflow">return</span> 0;</div>
<div class="line"> </div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="anamespacearmnn_xhtml_a93a3ba385cad27c4774e5fe64c025d3da0eaadb4fcb48a0a0ed7bc9868be9fbaa"><div class="ttname"><a href="namespacearmnn.xhtml#a93a3ba385cad27c4774e5fe64c025d3da0eaadb4fcb48a0a0ed7bc9868be9fbaa">armnn::LogSeverity::Warning</a></div><div class="ttdeci">@ Warning</div></div>
<div class="ttc" id="anamespacearmnn_xhtml_a14fcd7f88d11cea0a018269dca5f9277aec0fc0100c4fc1ce4eea230c3dc10360"><div class="ttname"><a href="namespacearmnn.xhtml#a14fcd7f88d11cea0a018269dca5f9277aec0fc0100c4fc1ce4eea230c3dc10360">armnn::MemorySource::Undefined</a></div><div class="ttdeci">@ Undefined</div></div>
<div class="ttc" id="anamespacearmnn_xhtml_a674efcf6cbdb9e831d653ff0e821fb38"><div class="ttname"><a href="namespacearmnn.xhtml#a674efcf6cbdb9e831d653ff0e821fb38">armnn::IOptimizedNetworkPtr</a></div><div class="ttdeci">std::unique_ptr&lt; IOptimizedNetwork, void(*)(IOptimizedNetwork *network)&gt; IOptimizedNetworkPtr</div><div class="ttdef"><b>Definition:</b> <a href="_i_network_8hpp_source.xhtml#l00328">INetwork.hpp:328</a></div></div>
<div class="ttc" id="a_utils_8hpp_xhtml"><div class="ttname"><a href="_utils_8hpp.xhtml">Utils.hpp</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_connectable_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_i_connectable_layer.xhtml">armnn::IConnectableLayer</a></div><div class="ttdoc">Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.</div><div class="ttdef"><b>Definition:</b> <a href="_i_network_8hpp_source.xhtml#l00068">INetwork.hpp:68</a></div></div>
<div class="ttc" id="astructarmnn_1_1_fully_connected_descriptor_xhtml"><div class="ttname"><a href="structarmnn_1_1_fully_connected_descriptor.xhtml">armnn::FullyConnectedDescriptor</a></div><div class="ttdoc">A FullyConnectedDescriptor for the FullyConnectedLayer.</div><div class="ttdef"><b>Definition:</b> <a href="_descriptors_8hpp_source.xhtml#l00495">Descriptors.hpp:495</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_output_slot_xhtml_a7e5c5771d741dd5473989047a9314728"><div class="ttname"><a href="classarmnn_1_1_output_slot.xhtml#a7e5c5771d741dd5473989047a9314728">armnn::OutputSlot::SetTensorInfo</a></div><div class="ttdeci">void SetTensorInfo(const TensorInfo &amp;tensorInfo) override</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8cpp_source.xhtml#l00087">Layer.cpp:87</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_input_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_input_layer.xhtml">armnn::InputLayer</a></div><div class="ttdoc">A layer user-provided data can be bound to (e.g. inputs, outputs).</div><div class="ttdef"><b>Definition:</b> <a href="_input_layer_8hpp_source.xhtml#l00013">InputLayer.hpp:13</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_const_tensor_xhtml"><div class="ttname"><a href="classarmnn_1_1_const_tensor.xhtml">armnn::ConstTensor</a></div><div class="ttdoc">A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.</div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.xhtml#l00327">Tensor.hpp:327</a></div></div>
<div class="ttc" id="anamespacearmnn_xhtml_aa59f7a819c3e29d10ffc41e5c0616872"><div class="ttname"><a href="namespacearmnn.xhtml#aa59f7a819c3e29d10ffc41e5c0616872">armnn::ConfigureLogging</a></div><div class="ttdeci">void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)</div><div class="ttdoc">Configures the logging behaviour of the ARMNN library.</div><div class="ttdef"><b>Definition:</b> <a href="_utils_8cpp_source.xhtml#l00018">Utils.cpp:18</a></div></div>
<div class="ttc" id="astructarmnn_1_1_i_runtime_1_1_creation_options_xhtml"><div class="ttname"><a href="structarmnn_1_1_i_runtime_1_1_creation_options.xhtml">armnn::IRuntime::CreationOptions</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_runtime_8hpp_source.xhtml#l00085">IRuntime.hpp:85</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_connectable_layer_xhtml_a80ac4eda2e7f2757ec9dd96fc96dbd16"><div class="ttname"><a href="classarmnn_1_1_i_connectable_layer.xhtml#a80ac4eda2e7f2757ec9dd96fc96dbd16">armnn::IConnectableLayer::GetOutputSlot</a></div><div class="ttdeci">virtual const IOutputSlot &amp; GetOutputSlot(unsigned int index) const =0</div><div class="ttdoc">Get the const output slot handle by slot index.</div></div>
<div class="ttc" id="anamespacearmnn_xhtml_aa42e128b41f4e966fc901f9bf42c5a1c"><div class="ttname"><a href="namespacearmnn.xhtml#aa42e128b41f4e966fc901f9bf42c5a1c">armnn::Optimize</a></div><div class="ttdeci">IOptimizedNetworkPtr Optimize(const INetwork &amp;network, const std::vector&lt; BackendId &gt; &amp;backendPreferences, const IDeviceSpec &amp;deviceSpec, const OptimizerOptionsOpaque &amp;options=OptimizerOptionsOpaque(), Optional&lt; std::vector&lt; std::string &gt; &amp; &gt; messages=EmptyOptional())</div><div class="ttdoc">Create an optimized version of the network.</div><div class="ttdef"><b>Definition:</b> <a href="_network_8cpp_source.xhtml#l02003">Network.cpp:2003</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_output_slot_xhtml_ac1835f8756a9f03c02fcf9664e3a0fce"><div class="ttname"><a href="classarmnn_1_1_i_output_slot.xhtml#ac1835f8756a9f03c02fcf9664e3a0fce">armnn::IOutputSlot::Connect</a></div><div class="ttdeci">virtual int Connect(IInputSlot &amp;destination)=0</div></div>
<div class="ttc" id="aclassarmnn_1_1_tensor_info_xhtml_a8ffca1e21bdfa7f945617acd606aac91"><div class="ttname"><a href="classarmnn_1_1_tensor_info.xhtml#a8ffca1e21bdfa7f945617acd606aac91">armnn::TensorInfo::SetConstant</a></div><div class="ttdeci">void SetConstant(const bool IsConstant=true)</div><div class="ttdoc">Marks the data corresponding to this tensor info as constant.</div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8cpp_source.xhtml#l00514">Tensor.cpp:514</a></div></div>
<div class="ttc" id="a_i_network_8hpp_xhtml"><div class="ttname"><a href="_i_network_8hpp.xhtml">INetwork.hpp</a></div></div>
<div class="ttc" id="anamespacearmnn_xhtml"><div class="ttname"><a href="namespacearmnn.xhtml">armnn</a></div><div class="ttdoc">Copyright (c) 2021 ARM Limited and Contributors.</div><div class="ttdef"><b>Definition:</b> <a href="01__00__quick__start_8dox_source.xhtml#l00006">01_00_quick_start.dox:6</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_connectable_layer_xhtml_a6ec9e0eb66d7d6a01240492a0b18104c"><div class="ttname"><a href="classarmnn_1_1_i_connectable_layer.xhtml#a6ec9e0eb66d7d6a01240492a0b18104c">armnn::IConnectableLayer::GetInputSlot</a></div><div class="ttdeci">virtual const IInputSlot &amp; GetInputSlot(unsigned int index) const =0</div><div class="ttdoc">Get a const input slot handle by slot index.</div></div>
<div class="ttc" id="astructarmnn_1_1_i_network_properties_xhtml"><div class="ttname"><a href="structarmnn_1_1_i_network_properties.xhtml">armnn::INetworkProperties</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_runtime_8hpp_source.xhtml#l00043">IRuntime.hpp:43</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_tensor_shape_xhtml"><div class="ttname"><a href="classarmnn_1_1_tensor_shape.xhtml">armnn::TensorShape</a></div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.xhtml#l00020">Tensor.hpp:20</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_layer_xhtml_a0e36688a43c35668d8db5257274c68fe"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">armnn::Layer::GetOutputSlot</a></div><div class="ttdeci">const OutputSlot &amp; GetOutputSlot(unsigned int index=0) const override</div><div class="ttdoc">Get the const output slot handle by slot index.</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00326">Layer.hpp:326</a></div></div>
<div class="ttc" id="anamespacearmnn_xhtml_ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204"><div class="ttname"><a href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">armnn::DataType::Float32</a></div><div class="ttdeci">@ Float32</div></div>
<div class="ttc" id="aclassarmnn_1_1_tensor_info_xhtml"><div class="ttname"><a href="classarmnn_1_1_tensor_info.xhtml">armnn::TensorInfo</a></div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.xhtml#l00152">Tensor.hpp:152</a></div></div>
<div class="ttc" id="anamespacearmnn_xhtml_a0d8160388a127c1a23b37bc88dc6e2ec"><div class="ttname"><a href="namespacearmnn.xhtml#a0d8160388a127c1a23b37bc88dc6e2ec">armnn::NetworkId</a></div><div class="ttdeci">int NetworkId</div><div class="ttdef"><b>Definition:</b> <a href="_i_runtime_8hpp_source.xhtml#l00035">IRuntime.hpp:35</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_layer_xhtml_acf8b8e23bf647836592982f97088d375"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">armnn::Layer::GetInputSlot</a></div><div class="ttdeci">const InputSlot &amp; GetInputSlot(unsigned int index) const override</div><div class="ttdoc">Get a const input slot handle by slot index.</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00324">Layer.hpp:324</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_network_xhtml_a41ce159095e95f7cd4174ce5d4662697"><div class="ttname"><a href="classarmnn_1_1_i_network.xhtml#a41ce159095e95f7cd4174ce5d4662697">armnn::INetwork::Create</a></div><div class="ttdeci">static INetworkPtr Create(const NetworkOptions &amp;networkOptions={})</div><div class="ttdef"><b>Definition:</b> <a href="_network_8cpp_source.xhtml#l00652">Network.cpp:652</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_output_slot_xhtml_adcfb97035799ea4c043f9ef370714815"><div class="ttname"><a href="classarmnn_1_1_output_slot.xhtml#adcfb97035799ea4c043f9ef370714815">armnn::OutputSlot::Connect</a></div><div class="ttdeci">int Connect(InputSlot &amp;destination)</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8cpp_source.xhtml#l00112">Layer.cpp:112</a></div></div>
<div class="ttc" id="a_i_runtime_8hpp_xhtml"><div class="ttname"><a href="_i_runtime_8hpp.xhtml">IRuntime.hpp</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_output_slot_xhtml_a5ee4a6c9a2481245487b1b1a70d20fd0"><div class="ttname"><a href="classarmnn_1_1_i_output_slot.xhtml#a5ee4a6c9a2481245487b1b1a70d20fd0">armnn::IOutputSlot::SetTensorInfo</a></div><div class="ttdeci">virtual void SetTensorInfo(const TensorInfo &amp;tensorInfo)=0</div></div>
<div class="ttc" id="a_descriptors_8hpp_xhtml"><div class="ttname"><a href="_descriptors_8hpp.xhtml">Descriptors.hpp</a></div></div>
<div class="ttc" id="anamespacearmnn_xhtml_ace74f6f9feb95a964a49d79458232703"><div class="ttname"><a href="namespacearmnn.xhtml#ace74f6f9feb95a964a49d79458232703">armnn::INetworkPtr</a></div><div class="ttdeci">std::unique_ptr&lt; INetwork, void(*)(INetwork *network)&gt; INetworkPtr</div><div class="ttdef"><b>Definition:</b> <a href="_i_network_8hpp_source.xhtml#l00327">INetwork.hpp:327</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_i_runtime_xhtml_ad44ecd3700748dc30dc4bbe34ba5bde7"><div class="ttname"><a href="classarmnn_1_1_i_runtime.xhtml#ad44ecd3700748dc30dc4bbe34ba5bde7">armnn::IRuntime::Create</a></div><div class="ttdeci">static IRuntimePtr Create(const CreationOptions &amp;options)</div><div class="ttdef"><b>Definition:</b> <a href="_runtime_8cpp_source.xhtml#l00052">Runtime.cpp:52</a></div></div>
<div class="ttc" id="a_armnn_converter_8cpp_xhtml_a0ddf1224851353fc92bfbff6f499fa97"><div class="ttname"><a href="_armnn_converter_8cpp.xhtml#a0ddf1224851353fc92bfbff6f499fa97">main</a></div><div class="ttdeci">int main(int argc, char *argv[])</div><div class="ttdef"><b>Definition:</b> <a href="_armnn_converter_8cpp_source.xhtml#l00327">ArmnnConverter.cpp:327</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_tensor_xhtml"><div class="ttname"><a href="classarmnn_1_1_tensor.xhtml">armnn::Tensor</a></div><div class="ttdoc">A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.</div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.xhtml#l00319">Tensor.hpp:319</a></div></div>
<div class="ttc" id="anamespacearmnn_xhtml_ae2f04a162585c0a5222a537efd5456aea83c2c4e9b658ccafbcbe6309c5d84c64"><div class="ttname"><a href="namespacearmnn.xhtml#ae2f04a162585c0a5222a537efd5456aea83c2c4e9b658ccafbcbe6309c5d84c64">armnn::Compute::CpuRef</a></div><div class="ttdeci">@ CpuRef</div><div class="ttdoc">CPU Execution: Reference C++ kernels.</div></div>
<div class="ttc" id="anamespacearmnn_xhtml_a150468a02bd7b2d2d061c4aaaee939f0"><div class="ttname"><a href="namespacearmnn.xhtml#a150468a02bd7b2d2d061c4aaaee939f0">armnn::IRuntimePtr</a></div><div class="ttdeci">std::unique_ptr&lt; IRuntime, void(*)(IRuntime *runtime)&gt; IRuntimePtr</div><div class="ttdef"><b>Definition:</b> <a href="_i_runtime_8hpp_source.xhtml#l00041">IRuntime.hpp:41</a></div></div>
<div class="ttc" id="aclassarmnn_1_1_output_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_output_layer.xhtml">armnn::OutputLayer</a></div><div class="ttdoc">A layer user-provided data can be bound to (e.g. inputs, outputs).</div><div class="ttdef"><b>Definition:</b> <a href="_output_layer_8hpp_source.xhtml#l00013">OutputLayer.hpp:13</a></div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Thu May 18 2023 10:35:39 for ArmNN by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>