Update ACL pin to 8abbabd6ad946441c8ef1a03896fa98f7801af1f
[platform/upstream/armnn.git] / Documentation / struct_create_network_impl.xhtml
1 <!-- Copyright (c) 2020 ARM Limited. -->
2 <!--                                 -->
3 <!-- SPDX-License-Identifier: MIT    -->
4 <!--                                 -->
5 <!-- HTML header for doxygen 1.8.13-->
6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7 <html xmlns="http://www.w3.org/1999/xhtml">
8 <head>
9 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
10 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
11 <meta name="generator" content="Doxygen 1.8.13"/>
12 <meta name="robots" content="NOINDEX, NOFOLLOW" />
13 <meta name="viewport" content="width=device-width, initial-scale=1"/>
14 <title>ArmNN: CreateNetworkImpl&lt; IParser &gt; Struct Template Reference</title>
15 <link href="tabs.css" rel="stylesheet" type="text/css"/>
16 <script type="text/javascript" src="jquery.js"></script>
17 <script type="text/javascript" src="dynsections.js"></script>
18 <link href="navtree.css" rel="stylesheet" type="text/css"/>
19 <script type="text/javascript" src="resize.js"></script>
20 <script type="text/javascript" src="navtreedata.js"></script>
21 <script type="text/javascript" src="navtree.js"></script>
22 <script type="text/javascript">
23   $(document).ready(initResizable);
24 </script>
25 <link href="search/search.css" rel="stylesheet" type="text/css"/>
26 <script type="text/javascript" src="search/searchdata.js"></script>
27 <script type="text/javascript" src="search/search.js"></script>
28 <script type="text/x-mathjax-config">
29   MathJax.Hub.Config({
30     extensions: ["tex2jax.js"],
31     jax: ["input/TeX","output/HTML-CSS"],
32 });
33 </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
34 <link href="doxygen.css" rel="stylesheet" type="text/css" />
35 <link href="stylesheet.css" rel="stylesheet" type="text/css"/>
36 </head>
37 <body>
38 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
39 <div id="titlearea">
40 <table cellspacing="0" cellpadding="0">
41  <tbody>
42  <tr style="height: 56px;">
43   <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 10rem; margin-top: .5rem; margin-left 10px"/>
44   <td style="padding-left: 0.5em;">
45    <div id="projectname">
46    &#160;<span id="projectnumber">20.02</span>
47    </div>
48   </td>
49  </tr>
50  </tbody>
51 </table>
52 </div>
53 <!-- end header part -->
54 <!-- Generated by Doxygen 1.8.13 -->
55 <script type="text/javascript">
56 var searchBox = new SearchBox("searchBox", "search",false,'Search');
57 </script>
58 <script type="text/javascript" src="menudata.js"></script>
59 <script type="text/javascript" src="menu.js"></script>
60 <script type="text/javascript">
61 $(function() {
62   initMenu('',true,false,'search.php','Search');
63   $(document).ready(function() { init_search(); });
64 });
65 </script>
66 <div id="main-nav"></div>
67 </div><!-- top -->
68 <div id="side-nav" class="ui-resizable side-nav-resizable">
69   <div id="nav-tree">
70     <div id="nav-tree-contents">
71       <div id="nav-sync" class="sync"></div>
72     </div>
73   </div>
74   <div id="splitbar" style="-moz-user-select:none;" 
75        class="ui-resizable-handle">
76   </div>
77 </div>
78 <script type="text/javascript">
79 $(document).ready(function(){initNavTree('struct_create_network_impl.xhtml','');});
80 </script>
81 <div id="doc-content">
82 <!-- window showing the filter options -->
83 <div id="MSearchSelectWindow"
84      onmouseover="return searchBox.OnSearchSelectShow()"
85      onmouseout="return searchBox.OnSearchSelectHide()"
86      onkeydown="return searchBox.OnSearchSelectKey(event)">
87 </div>
88
89 <!-- iframe showing the search results (closed by default) -->
90 <div id="MSearchResultsWindow">
91 <iframe src="javascript:void(0)" frameborder="0" 
92         name="MSearchResults" id="MSearchResults">
93 </iframe>
94 </div>
95
96 <div class="header">
97   <div class="summary">
98 <a href="#pub-types">Public Types</a> &#124;
99 <a href="#pub-static-methods">Static Public Member Functions</a> &#124;
100 <a href="struct_create_network_impl-members.xhtml">List of all members</a>  </div>
101   <div class="headertitle">
102 <div class="title">CreateNetworkImpl&lt; IParser &gt; Struct Template Reference</div>  </div>
103 </div><!--header-->
104 <div class="contents">
105
106 <p><code>#include &lt;<a class="el" href="_inference_model_8hpp_source.xhtml">InferenceModel.hpp</a>&gt;</code></p>
107 <table class="memberdecls">
108 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
109 Public Types</h2></td></tr>
110 <tr class="memitem:a2e61c7404108440828ef7a45f310e229"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_create_network_impl.xhtml#a2e61c7404108440828ef7a45f310e229">Params</a> = <a class="el" href="struct_inference_model_internal_1_1_params.xhtml">InferenceModelInternal::Params</a></td></tr>
111 <tr class="separator:a2e61c7404108440828ef7a45f310e229"><td class="memSeparator" colspan="2">&#160;</td></tr>
112 </table><table class="memberdecls">
113 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
114 Static Public Member Functions</h2></td></tr>
115 <tr class="memitem:a4cbece5e7793be85f9a1e8a0ab9e02f8"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="namespacearmnn.xhtml#ace74f6f9feb95a964a49d79458232703">armnn::INetworkPtr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_create_network_impl.xhtml#a4cbece5e7793be85f9a1e8a0ab9e02f8">Create</a> (const <a class="el" href="struct_create_network_impl.xhtml#a2e61c7404108440828ef7a45f310e229">Params</a> &amp;params, std::vector&lt; <a class="el" href="namespacearmnn.xhtml#a280670a263dc4fd40491f6d0a2737f44">armnn::BindingPointInfo</a> &gt; &amp;inputBindings, std::vector&lt; <a class="el" href="namespacearmnn.xhtml#a280670a263dc4fd40491f6d0a2737f44">armnn::BindingPointInfo</a> &gt; &amp;outputBindings)</td></tr>
116 <tr class="separator:a4cbece5e7793be85f9a1e8a0ab9e02f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
117 </table>
118 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
119 <div class="textblock"><h3>template&lt;typename IParser&gt;<br />
120 struct CreateNetworkImpl&lt; IParser &gt;</h3>
121
122
123 <p class="definition">Definition at line <a class="el" href="_inference_model_8hpp_source.xhtml#l00111">111</a> of file <a class="el" href="_inference_model_8hpp_source.xhtml">InferenceModel.hpp</a>.</p>
124 </div><h2 class="groupheader">Member Typedef Documentation</h2>
125 <a id="a2e61c7404108440828ef7a45f310e229"></a>
126 <h2 class="memtitle"><span class="permalink"><a href="#a2e61c7404108440828ef7a45f310e229">&#9670;&nbsp;</a></span>Params</h2>
127
128 <div class="memitem">
129 <div class="memproto">
130       <table class="memname">
131         <tr>
132           <td class="memname">using <a class="el" href="struct_create_network_impl.xhtml#a2e61c7404108440828ef7a45f310e229">Params</a> =  <a class="el" href="struct_inference_model_internal_1_1_params.xhtml">InferenceModelInternal::Params</a></td>
133         </tr>
134       </table>
135 </div><div class="memdoc">
136
137 <p class="definition">Definition at line <a class="el" href="_inference_model_8hpp_source.xhtml#l00114">114</a> of file <a class="el" href="_inference_model_8hpp_source.xhtml">InferenceModel.hpp</a>.</p>
138
139 </div>
140 </div>
141 <h2 class="groupheader">Member Function Documentation</h2>
142 <a id="a4cbece5e7793be85f9a1e8a0ab9e02f8"></a>
143 <h2 class="memtitle"><span class="permalink"><a href="#a4cbece5e7793be85f9a1e8a0ab9e02f8">&#9670;&nbsp;</a></span>Create()</h2>
144
145 <div class="memitem">
146 <div class="memproto">
147 <table class="mlabels">
148   <tr>
149   <td class="mlabels-left">
150       <table class="memname">
151         <tr>
152           <td class="memname">static <a class="el" href="namespacearmnn.xhtml#ace74f6f9feb95a964a49d79458232703">armnn::INetworkPtr</a> Create </td>
153           <td>(</td>
154           <td class="paramtype">const <a class="el" href="struct_create_network_impl.xhtml#a2e61c7404108440828ef7a45f310e229">Params</a> &amp;&#160;</td>
155           <td class="paramname"><em>params</em>, </td>
156         </tr>
157         <tr>
158           <td class="paramkey"></td>
159           <td></td>
160           <td class="paramtype">std::vector&lt; <a class="el" href="namespacearmnn.xhtml#a280670a263dc4fd40491f6d0a2737f44">armnn::BindingPointInfo</a> &gt; &amp;&#160;</td>
161           <td class="paramname"><em>inputBindings</em>, </td>
162         </tr>
163         <tr>
164           <td class="paramkey"></td>
165           <td></td>
166           <td class="paramtype">std::vector&lt; <a class="el" href="namespacearmnn.xhtml#a280670a263dc4fd40491f6d0a2737f44">armnn::BindingPointInfo</a> &gt; &amp;&#160;</td>
167           <td class="paramname"><em>outputBindings</em>&#160;</td>
168         </tr>
169         <tr>
170           <td></td>
171           <td>)</td>
172           <td></td><td></td>
173         </tr>
174       </table>
175   </td>
176   <td class="mlabels-right">
177 <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
178   </tr>
179 </table>
180 </div><div class="memdoc">
181
182 <p class="definition">Definition at line <a class="el" href="_inference_model_8hpp_source.xhtml#l00116">116</a> of file <a class="el" href="_inference_model_8hpp_source.xhtml">InferenceModel.hpp</a>.</p>
183
184 <p class="reference">References <a class="el" href="_heap_profiling_8hpp_source.xhtml#l00045">ARMNN_SCOPED_HEAP_PROFILING</a>, <a class="el" href="_exceptions_8hpp_source.xhtml#l00192">CHECK_LOCATION</a>, <a class="el" href="_i_deserializer_8hpp_source.xhtml#l00020">BindingPointInfo::m_BindingId</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00085">Params::m_InputBindings</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00086">Params::m_InputShapes</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00091">Params::m_IsModelBinary</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00084">Params::m_ModelPath</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00087">Params::m_OutputBindings</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00095">Params::m_ParseUnsupported</a>, <a class="el" href="_inference_model_8hpp_source.xhtml#l00090">Params::m_SubgraphId</a>, <a class="el" href="_i_deserializer_8hpp_source.xhtml#l00021">BindingPointInfo::m_TensorInfo</a>, <a class="el" href="_numeric_cast_8hpp_source.xhtml#l00033">armnn::numeric_cast()</a>, and <a class="el" href="_file_only_profiling_decorator_tests_8cpp_source.xhtml#l00045">options</a>.</p>
185
186 <p class="reference">Referenced by <a class="el" href="_inference_model_8hpp_source.xhtml#l00371">InferenceModel&lt; IParser, TDataType &gt;::InferenceModel()</a>.</p>
187 <div class="fragment"><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    {</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        <span class="keyword">const</span> std::string&amp; modelPath = params.m_ModelPath;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        <span class="comment">// Create a network from a file on disk</span></div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        <span class="keyword">auto</span> parser(IParser::Create());</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        std::map&lt;std::string, armnn::TensorShape&gt; inputShapes;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        <span class="keywordflow">if</span> (!params.m_InputShapes.empty())</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        {</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> numInputShapes   = params.m_InputShapes.size();</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> numInputBindings = params.m_InputBindings.size();</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            <span class="keywordflow">if</span> (numInputShapes &lt; numInputBindings)</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            {</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_exception.xhtml">armnn::Exception</a>(boost::str(boost::format(</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;                    <span class="stringliteral">&quot;Not every input has its tensor shape specified: expected=%1%, got=%2%&quot;</span>)</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;                    % numInputBindings % numInputShapes));</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            }</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; numInputShapes; i++)</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            {</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;                inputShapes[params.m_InputBindings[i]] = params.m_InputShapes[i];</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            }</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        }</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        std::vector&lt;std::string&gt; requestedOutputs = params.m_OutputBindings;</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        <a class="code" href="namespacearmnn.xhtml#ace74f6f9feb95a964a49d79458232703">armnn::INetworkPtr</a> network{<span class="keyword">nullptr</span>, [](<a class="code" href="classarmnn_1_1_i_network.xhtml">armnn::INetwork</a> *){}};</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        {</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            <a class="code" href="_heap_profiling_8hpp.xhtml#aeeb927880fc4ffc2eea754a67d884a53">ARMNN_SCOPED_HEAP_PROFILING</a>(<span class="stringliteral">&quot;Parsing&quot;</span>);</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            <span class="comment">// Handle text and binary input differently by calling the corresponding parser function</span></div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;            network = (params.m_IsModelBinary ?</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;                parser-&gt;CreateNetworkFromBinaryFile(modelPath.c_str(), inputShapes, requestedOutputs) :</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                parser-&gt;CreateNetworkFromTextFile(modelPath.c_str(), inputShapes, requestedOutputs));</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        }</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;        <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; inputLayerName : params.m_InputBindings)</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        {</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;            inputBindings.push_back(parser-&gt;GetNetworkInputBindingInfo(inputLayerName));</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;        }</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;        <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; outputLayerName : params.m_OutputBindings)</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        {</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;            outputBindings.push_back(parser-&gt;GetNetworkOutputBindingInfo(outputLayerName));</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        }</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keywordflow">return</span> network;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    }</div><div class="ttc" id="classarmnn_1_1_i_network_xhtml"><div class="ttname"><a href="classarmnn_1_1_i_network.xhtml">armnn::INetwork</a></div><div class="ttdoc">Main network class which provides the interface for building up a neural network. ...</div><div class="ttdef"><b>Definition:</b> <a href="_i_network_8hpp_source.xhtml#l00105">INetwork.hpp:105</a></div></div>
188 <div class="ttc" id="_heap_profiling_8hpp_xhtml_aeeb927880fc4ffc2eea754a67d884a53"><div class="ttname"><a href="_heap_profiling_8hpp.xhtml#aeeb927880fc4ffc2eea754a67d884a53">ARMNN_SCOPED_HEAP_PROFILING</a></div><div class="ttdeci">#define ARMNN_SCOPED_HEAP_PROFILING(TAG)</div><div class="ttdef"><b>Definition:</b> <a href="_heap_profiling_8hpp_source.xhtml#l00045">HeapProfiling.hpp:45</a></div></div>
189 <div class="ttc" id="classarmnn_1_1_exception_xhtml"><div class="ttname"><a href="classarmnn_1_1_exception.xhtml">armnn::Exception</a></div><div class="ttdoc">Base class for all ArmNN exceptions so that users can filter to just those. </div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.xhtml#l00046">Exceptions.hpp:46</a></div></div>
190 <div class="ttc" id="namespacearmnn_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#l00101">INetwork.hpp:101</a></div></div>
191 </div><!-- fragment -->
192 </div>
193 </div>
194 <hr/>The documentation for this struct was generated from the following file:<ul>
195 <li>tests/<a class="el" href="_inference_model_8hpp_source.xhtml">InferenceModel.hpp</a></li>
196 </ul>
197 </div><!-- contents -->
198 </div><!-- doc-content -->
199 <!-- start footer part -->
200 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
201   <ul>
202     <li class="navelem"><a class="el" href="struct_create_network_impl.xhtml">CreateNetworkImpl</a></li>
203     <li class="footer">Generated on Fri Mar 13 2020 16:09:16 for ArmNN by
204     <a href="http://www.doxygen.org/index.html">
205     <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
206   </ul>
207 </div>
208 </body>
209 </html>