Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 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: src/armnn/NetworkUtils.cpp Source File</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 |  <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('_network_utils_8cpp_source.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="headertitle"> |
| 98 | <div class="title">NetworkUtils.cpp</div> </div> |
| 99 | </div><!--header--> |
| 100 | <div class="contents"> |
| 101 | <a href="_network_utils_8cpp.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright © 2017 Arm Ltd. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> </div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "<a class="code" href="_network_utils_8hpp.xhtml">NetworkUtils.hpp</a>"</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> </div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include "<a class="code" href="_subgraph_view_selector_8hpp.xhtml">SubgraphViewSelector.hpp</a>"</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> </div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <<a class="code" href="_exceptions_8hpp.xhtml">armnn/Exceptions.hpp</a>></span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <<a class="code" href="_backend_registry_8hpp.xhtml">armnn/BackendRegistry.hpp</a>></span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="keyword">namespace </span><a class="code" href="namespacearmnn.xhtml">armnn</a></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> {</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="keyword">namespace</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> {</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="keywordtype">void</span> UpdateOutputSlotFp16ToFp32(OutputSlot& outputSlot)</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keyword">const</span> TensorInfo& origTensorInfo = outputSlot.GetTensorInfo();</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  TensorInfo newTensorInfo(origTensorInfo);</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  newTensorInfo.SetDataType(<a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">DataType::Float32</a>);</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  outputSlot.SetTensorInfo(newTensorInfo);</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> }</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="keywordtype">void</span> ChangeOutputFp16ToFp32(Layer& layer)</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> {</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span>&& outputSlot = layer.BeginOutputSlots(); outputSlot != layer.EndOutputSlots(); ++outputSlot)</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  {</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">if</span> (outputSlot->GetTensorInfo().GetDataType() == <a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a26e6ed77470c6f2f830ecf874e6c0d55">DataType::Float16</a>)</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  UpdateOutputSlotFp16ToFp32(*outputSlot);</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  }</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  }</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> }</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> } <span class="comment">// anonymous namespace</span></div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="namespacearmnn.xhtml#ad31c56533e4f9f9f51719599fbfcf7bb"> 40</a></span> std::vector<ConvertFp16ToFp32Layer*> <a class="code" href="namespacearmnn.xhtml#ad31c56533e4f9f9f51719599fbfcf7bb">InsertConvertFp16ToFp32LayersBefore</a>(<a class="code" href="classarmnn_1_1_graph.xhtml">Graph</a>& graph,</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>& layer,</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordtype">bool</span> expectCorrectInputType)</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> {</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  std::vector<ConvertFp16ToFp32Layer*> convertLayers;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  convertLayers.reserve(layer.<a class="code" href="classarmnn_1_1_layer.xhtml#abc0660dc440c8a285b456c9ef6383c26">GetNumInputSlots</a>());</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="comment">// Insert a ConvertFp16ToFp32Layer before each input slot</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span>&& inputSlot = layer.<a class="code" href="classarmnn_1_1_layer.xhtml#af6cb8de21ef0da269ec9b67755ae92a0">BeginInputSlots</a>(); inputSlot != layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a9752e12d6b79e18da1a25f76159d2a72">EndInputSlots</a>(); ++inputSlot)</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  {</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">bool</span> allowInsert = <span class="keyword">true</span>;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">if</span> (expectCorrectInputType)</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="comment">// Only insert ConvertFp16ToFp32Layer before FP16 input slots</span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="code" href="classarmnn_1_1_output_slot.xhtml">OutputSlot</a>* connectedOutputSlot = inputSlot->GetConnectedOutputSlot();</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  allowInsert =</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  connectedOutputSlot && connectedOutputSlot-><a class="code" href="classarmnn_1_1_output_slot.xhtml#ada2ad7d1caeeb4ef6195c8925fad6a65">GetTensorInfo</a>().<a class="code" href="classarmnn_1_1_tensor_info.xhtml#aea909c7327109228ef618d459015def3">GetDataType</a>() == <a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a26e6ed77470c6f2f830ecf874e6c0d55">DataType::Float16</a>;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  }</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">if</span> (allowInsert)</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  {</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keyword">const</span> std::string name =</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  std::string(<span class="stringliteral">"convert_fp16_to_fp32-"</span> + std::to_string(inputSlot->GetSlotIndex()) + <span class="stringliteral">"-"</span>) +</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a7ddf0cf6f620d59c10e63495ace795d0">GetName</a>();</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <a class="code" href="classarmnn_1_1_convert_fp16_to_fp32_layer.xhtml">ConvertFp16ToFp32Layer</a>* convertLayer =</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  graph.<a class="code" href="classarmnn_1_1_graph.xhtml#a3ff30c6669fdc69de1f5be1f89bacc3f">InsertNewLayer</a><<a class="code" href="classarmnn_1_1_convert_fp16_to_fp32_layer.xhtml">ConvertFp16ToFp32Layer</a>>(*inputSlot, name.c_str());</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="classarmnn_1_1_tensor_info.xhtml">TensorInfo</a> convertInfo = convertLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0).<a class="code" href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">GetConnectedOutputSlot</a>()-><a class="code" href="classarmnn_1_1_output_slot.xhtml#ada2ad7d1caeeb4ef6195c8925fad6a65">GetTensorInfo</a>();</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  convertInfo.<a class="code" href="classarmnn_1_1_tensor_info.xhtml#a71975fcec1464d639f1a78f73164d1bd">SetDataType</a>(<a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">DataType::Float32</a>);</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  convertLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">GetOutputSlot</a>().<a class="code" href="classarmnn_1_1_output_slot.xhtml#a7e5c5771d741dd5473989047a9314728">SetTensorInfo</a>(convertInfo);</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  convertLayers.emplace_back(convertLayer);</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  }</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">return</span> convertLayers;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> }</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="namespacearmnn.xhtml#abf625e50a5eaeafce5b39580dc95a9d3"> 79</a></span> std::vector<ConvertFp32ToFp16Layer*> <a class="code" href="namespacearmnn.xhtml#abf625e50a5eaeafce5b39580dc95a9d3">InsertConvertFp32ToFp16LayersAfter</a>(<a class="code" href="classarmnn_1_1_graph.xhtml">Graph</a>& graph, <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>& layer)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> numOutputSlots = layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a1594bddc87d6477df300317658f566bb">GetNumOutputSlots</a>();</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> </div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  std::vector<ConvertFp32ToFp16Layer*> convertLayers;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  convertLayers.reserve(numOutputSlots);</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> </div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="comment">// Update FP16 output slots to FP32 on current layer</span></div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  ChangeOutputFp16ToFp32(layer);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="comment">// Insert a ConvertFp32ToFp16Layer after each FP32 output slot</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> slotIndex = 0u; slotIndex < numOutputSlots; ++slotIndex)</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  {</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <a class="code" href="classarmnn_1_1_output_slot.xhtml">OutputSlot</a>& outputSlot = layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">GetOutputSlot</a>(slotIndex);</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">if</span>(outputSlot.<a class="code" href="classarmnn_1_1_output_slot.xhtml#ada2ad7d1caeeb4ef6195c8925fad6a65">GetTensorInfo</a>().<a class="code" href="classarmnn_1_1_tensor_info.xhtml#aea909c7327109228ef618d459015def3">GetDataType</a>() == <a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">DataType::Float32</a>)</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  {</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keyword">const</span> std::string name =</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  std::string(<span class="stringliteral">"convert_fp32_to_fp16-"</span> + std::to_string(slotIndex) + <span class="stringliteral">"-"</span>) + layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a7ddf0cf6f620d59c10e63495ace795d0">GetName</a>();</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <a class="code" href="classarmnn_1_1_convert_fp32_to_fp16_layer.xhtml">ConvertFp32ToFp16Layer</a>* convertLayer =</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  graph.<a class="code" href="classarmnn_1_1_graph.xhtml#a3ff30c6669fdc69de1f5be1f89bacc3f">InsertNewLayer</a><<a class="code" href="classarmnn_1_1_convert_fp32_to_fp16_layer.xhtml">ConvertFp32ToFp16Layer</a>>(outputSlot, name.c_str());</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <a class="code" href="classarmnn_1_1_tensor_info.xhtml">TensorInfo</a> convertInfo = convertLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0).<a class="code" href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">GetConnectedOutputSlot</a>()-><a class="code" href="classarmnn_1_1_output_slot.xhtml#ada2ad7d1caeeb4ef6195c8925fad6a65">GetTensorInfo</a>();</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  convertInfo.<a class="code" href="classarmnn_1_1_tensor_info.xhtml#a71975fcec1464d639f1a78f73164d1bd">SetDataType</a>(<a class="code" href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a26e6ed77470c6f2f830ecf874e6c0d55">DataType::Float16</a>);</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  convertLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">GetOutputSlot</a>().<a class="code" href="classarmnn_1_1_output_slot.xhtml#a7e5c5771d741dd5473989047a9314728">SetTensorInfo</a>(convertInfo);</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  convertLayers.emplace_back(convertLayer);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  }</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  }</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">return</span> convertLayers;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> }</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span> </div><div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="namespacearmnn.xhtml#a2616ffdae2db993af5c08019fb61860a"> 112</a></span> std::vector<DebugLayer*> <a class="code" href="namespacearmnn.xhtml#a2616ffdae2db993af5c08019fb61860a">InsertDebugLayerAfter</a>(<a class="code" href="classarmnn_1_1_graph.xhtml">Graph</a>& graph, <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>& layer)</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> {</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  std::vector<DebugLayer*> debugLayers;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  debugLayers.reserve(layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a1594bddc87d6477df300317658f566bb">GetNumOutputSlots</a>());</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="comment">// Connect a DebugLayer to each output slot of the layer</span></div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> outputSlot = layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a817d4be6dd88f532d36f51748ec14185">BeginOutputSlots</a>(); outputSlot != layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a55f76d98fcd2f5cdac3e2b14536cb7ab">EndOutputSlots</a>(); ++outputSlot)</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  {</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keyword">const</span> std::string debugName = std::string(<span class="stringliteral">"DebugLayerAfter"</span>) + layer.<a class="code" href="classarmnn_1_1_layer.xhtml#a9a97cb6d32661a57fc33bd29b8e41ff4">GetNameStr</a>();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <a class="code" href="classarmnn_1_1_debug_layer.xhtml">DebugLayer</a>* debugLayer =</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  graph.<a class="code" href="classarmnn_1_1_graph.xhtml#a3ff30c6669fdc69de1f5be1f89bacc3f">InsertNewLayer</a><<a class="code" href="classarmnn_1_1_debug_layer.xhtml">DebugLayer</a>>(*outputSlot, debugName.c_str());</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="comment">// Sets output tensor info for the debug layer.</span></div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  BOOST_ASSERT(debugLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0).<a class="code" href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">GetConnectedOutputSlot</a>() == &(*outputSlot));</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <a class="code" href="classarmnn_1_1_tensor_info.xhtml">TensorInfo</a> debugInfo = debugLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0).<a class="code" href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">GetConnectedOutputSlot</a>()-><a class="code" href="classarmnn_1_1_output_slot.xhtml#ada2ad7d1caeeb4ef6195c8925fad6a65">GetTensorInfo</a>();</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> </div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  debugLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#a0e36688a43c35668d8db5257274c68fe">GetOutputSlot</a>().<a class="code" href="classarmnn_1_1_output_slot.xhtml#a7e5c5771d741dd5473989047a9314728">SetTensorInfo</a>(debugInfo);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="comment">// NOTE: It is OK to do this because DebugLayer is only supported on CpuRef</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  debugLayer-><a class="code" href="classarmnn_1_1_layer.xhtml#a3f6ad59212fa8a47c9265162fff8a274">SetBackendId</a>(<a class="code" href="namespacearmnn.xhtml#ae2f04a162585c0a5222a537efd5456aea83c2c4e9b658ccafbcbe6309c5d84c64">Compute::CpuRef</a>);</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  debugLayers.emplace_back(debugLayer);</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  }</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> </div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="keywordflow">return</span> debugLayers;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> }</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> </div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span> } <span class="comment">// namespace armnn</span></div><div class="ttc" id="classarmnn_1_1_layer_xhtml_a9752e12d6b79e18da1a25f76159d2a72"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a9752e12d6b79e18da1a25f76159d2a72">armnn::Layer::EndInputSlots</a></div><div class="ttdeci">std::vector< InputSlot >::iterator EndInputSlots()</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00236">Layer.hpp:236</a></div></div> |
| 102 | <div class="ttc" id="namespacearmnn_xhtml_abf625e50a5eaeafce5b39580dc95a9d3"><div class="ttname"><a href="namespacearmnn.xhtml#abf625e50a5eaeafce5b39580dc95a9d3">armnn::InsertConvertFp32ToFp16LayersAfter</a></div><div class="ttdeci">std::vector< ConvertFp32ToFp16Layer * > InsertConvertFp32ToFp16LayersAfter(Graph &graph, Layer &layer)</div><div class="ttdef"><b>Definition:</b> <a href="_network_utils_8cpp_source.xhtml#l00079">NetworkUtils.cpp:79</a></div></div> |
| 103 | <div class="ttc" id="namespacearmnn_xhtml_ad31c56533e4f9f9f51719599fbfcf7bb"><div class="ttname"><a href="namespacearmnn.xhtml#ad31c56533e4f9f9f51719599fbfcf7bb">armnn::InsertConvertFp16ToFp32LayersBefore</a></div><div class="ttdeci">std::vector< ConvertFp16ToFp32Layer * > InsertConvertFp16ToFp32LayersBefore(Graph &graph, Layer &layer, bool expectCorrectInputType)</div><div class="ttdef"><b>Definition:</b> <a href="_network_utils_8cpp_source.xhtml#l00040">NetworkUtils.cpp:40</a></div></div> |
| 104 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_abc0660dc440c8a285b456c9ef6383c26"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#abc0660dc440c8a285b456c9ef6383c26">armnn::Layer::GetNumInputSlots</a></div><div class="ttdeci">unsigned int GetNumInputSlots() const override</div><div class="ttdoc">Returns the number of connectable input slots. </div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00307">Layer.hpp:307</a></div></div> |
| 105 | <div class="ttc" id="namespacearmnn_xhtml_ae2f04a162585c0a5222a537efd5456aea83c2c4e9b658ccafbcbe6309c5d84c64"><div class="ttname"><a href="namespacearmnn.xhtml#ae2f04a162585c0a5222a537efd5456aea83c2c4e9b658ccafbcbe6309c5d84c64">armnn::Compute::CpuRef</a></div><div class="ttdoc">CPU Execution: Reference C++ kernels. </div></div> |
| 106 | <div class="ttc" id="classarmnn_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#l00053">Tensor.hpp:53</a></div></div> |
| 107 | <div class="ttc" id="classarmnn_1_1_convert_fp16_to_fp32_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_convert_fp16_to_fp32_layer.xhtml">armnn::ConvertFp16ToFp32Layer</a></div><div class="ttdoc">This layer converts data type Float 16 to Float 32. </div><div class="ttdef"><b>Definition:</b> <a href="_convert_fp16_to_fp32_layer_8hpp_source.xhtml#l00014">ConvertFp16ToFp32Layer.hpp:14</a></div></div> |
| 108 | <div class="ttc" id="namespacearmnn_xhtml"><div class="ttname"><a href="namespacearmnn.xhtml">armnn</a></div><div class="ttdoc">Copyright (c) 2020 ARM Limited. </div><div class="ttdef"><b>Definition:</b> <a href="00__introduction_8dox_source.xhtml#l00025">00_introduction.dox:25</a></div></div> |
| 109 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_a3f6ad59212fa8a47c9265162fff8a274"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a3f6ad59212fa8a47c9265162fff8a274">armnn::Layer::SetBackendId</a></div><div class="ttdeci">void SetBackendId(const BackendId &id)</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00264">Layer.hpp:264</a></div></div> |
| 110 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_a1594bddc87d6477df300317658f566bb"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a1594bddc87d6477df300317658f566bb">armnn::Layer::GetNumOutputSlots</a></div><div class="ttdeci">unsigned int GetNumOutputSlots() const override</div><div class="ttdoc">Returns the number of connectable output slots. </div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00308">Layer.hpp:308</a></div></div> |
| 111 | <div class="ttc" id="_backend_registry_8hpp_xhtml"><div class="ttname"><a href="_backend_registry_8hpp.xhtml">BackendRegistry.hpp</a></div></div> |
| 112 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_af6cb8de21ef0da269ec9b67755ae92a0"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#af6cb8de21ef0da269ec9b67755ae92a0">armnn::Layer::BeginInputSlots</a></div><div class="ttdeci">std::vector< InputSlot >::iterator BeginInputSlots()</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00235">Layer.hpp:235</a></div></div> |
| 113 | <div class="ttc" id="classarmnn_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 & 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#l00310">Layer.hpp:310</a></div></div> |
| 114 | <div class="ttc" id="classarmnn_1_1_tensor_info_xhtml_aea909c7327109228ef618d459015def3"><div class="ttname"><a href="classarmnn_1_1_tensor_info.xhtml#aea909c7327109228ef618d459015def3">armnn::TensorInfo::GetDataType</a></div><div class="ttdeci">DataType GetDataType() const</div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.xhtml#l00095">Tensor.hpp:95</a></div></div> |
| 115 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_a9a97cb6d32661a57fc33bd29b8e41ff4"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a9a97cb6d32661a57fc33bd29b8e41ff4">armnn::Layer::GetNameStr</a></div><div class="ttdeci">const std::string & GetNameStr() const</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00216">Layer.hpp:216</a></div></div> |
| 116 | <div class="ttc" id="_network_utils_8hpp_xhtml"><div class="ttname"><a href="_network_utils_8hpp.xhtml">NetworkUtils.hpp</a></div></div> |
| 117 | <div class="ttc" id="namespacearmnn_xhtml_ad8ed01ff3ff33333d8e19db4d2818bb6a26e6ed77470c6f2f830ecf874e6c0d55"><div class="ttname"><a href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a26e6ed77470c6f2f830ecf874e6c0d55">armnn::DataType::Float16</a></div></div> |
| 118 | <div class="ttc" id="classarmnn_1_1_output_slot_xhtml"><div class="ttname"><a href="classarmnn_1_1_output_slot.xhtml">armnn::OutputSlot</a></div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00083">Layer.hpp:83</a></div></div> |
| 119 | <div class="ttc" id="classarmnn_1_1_debug_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_debug_layer.xhtml">armnn::DebugLayer</a></div><div class="ttdoc">This layer visualizes the data flowing through the network. </div><div class="ttdef"><b>Definition:</b> <a href="_debug_layer_8hpp_source.xhtml#l00013">DebugLayer.hpp:13</a></div></div> |
| 120 | <div class="ttc" id="classarmnn_1_1_input_slot_xhtml_a9effd325a6d512a3f8ff4bd207d53255"><div class="ttname"><a href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">armnn::InputSlot::GetConnectedOutputSlot</a></div><div class="ttdeci">const OutputSlot * GetConnectedOutputSlot() const</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00055">Layer.hpp:55</a></div></div> |
| 121 | <div class="ttc" id="classarmnn_1_1_tensor_info_xhtml_a71975fcec1464d639f1a78f73164d1bd"><div class="ttname"><a href="classarmnn_1_1_tensor_info.xhtml#a71975fcec1464d639f1a78f73164d1bd">armnn::TensorInfo::SetDataType</a></div><div class="ttdeci">void SetDataType(DataType type)</div><div class="ttdef"><b>Definition:</b> <a href="_tensor_8hpp_source.xhtml#l00096">Tensor.hpp:96</a></div></div> |
| 122 | <div class="ttc" id="classarmnn_1_1_graph_xhtml"><div class="ttname"><a href="classarmnn_1_1_graph.xhtml">armnn::Graph</a></div><div class="ttdef"><b>Definition:</b> <a href="_graph_8hpp_source.xhtml#l00029">Graph.hpp:29</a></div></div> |
| 123 | <div class="ttc" id="classarmnn_1_1_convert_fp32_to_fp16_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_convert_fp32_to_fp16_layer.xhtml">armnn::ConvertFp32ToFp16Layer</a></div><div class="ttdoc">This layer converts data type Float 32 to Float 16. </div><div class="ttdef"><b>Definition:</b> <a href="_convert_fp32_to_fp16_layer_8hpp_source.xhtml#l00013">ConvertFp32ToFp16Layer.hpp:13</a></div></div> |
| 124 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_a817d4be6dd88f532d36f51748ec14185"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a817d4be6dd88f532d36f51748ec14185">armnn::Layer::BeginOutputSlots</a></div><div class="ttdeci">std::vector< OutputSlot >::iterator BeginOutputSlots()</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00239">Layer.hpp:239</a></div></div> |
| 125 | <div class="ttc" id="_exceptions_8hpp_xhtml"><div class="ttname"><a href="_exceptions_8hpp.xhtml">Exceptions.hpp</a></div></div> |
| 126 | <div class="ttc" id="classarmnn_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 &tensorInfo) override</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8cpp_source.xhtml#l00058">Layer.cpp:58</a></div></div> |
| 127 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_a55f76d98fcd2f5cdac3e2b14536cb7ab"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a55f76d98fcd2f5cdac3e2b14536cb7ab">armnn::Layer::EndOutputSlots</a></div><div class="ttdeci">std::vector< OutputSlot >::iterator EndOutputSlots()</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00240">Layer.hpp:240</a></div></div> |
| 128 | <div class="ttc" id="classarmnn_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 & 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#l00312">Layer.hpp:312</a></div></div> |
| 129 | <div class="ttc" id="namespacearmnn_xhtml_ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204"><div class="ttname"><a href="namespacearmnn.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6a166495adc0d0f53bee6baecc577f5204">armnn::DataType::Float32</a></div></div> |
| 130 | <div class="ttc" id="classarmnn_1_1_layer_xhtml_a7ddf0cf6f620d59c10e63495ace795d0"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#a7ddf0cf6f620d59c10e63495ace795d0">armnn::Layer::GetName</a></div><div class="ttdeci">const char * GetName() const override</div><div class="ttdoc">Returns the name of the layer. </div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00305">Layer.hpp:305</a></div></div> |
| 131 | <div class="ttc" id="classarmnn_1_1_graph_xhtml_a3ff30c6669fdc69de1f5be1f89bacc3f"><div class="ttname"><a href="classarmnn_1_1_graph.xhtml#a3ff30c6669fdc69de1f5be1f89bacc3f">armnn::Graph::InsertNewLayer</a></div><div class="ttdeci">LayerT * InsertNewLayer(InputSlot &insertBefore, Args &&... args)</div><div class="ttdoc">Inserts a new layer between the output slot currently connected to insertBefore and insertBefore itse...</div><div class="ttdef"><b>Definition:</b> <a href="_graph_8hpp_source.xhtml#l00409">Graph.hpp:409</a></div></div> |
| 132 | <div class="ttc" id="namespacearmnn_xhtml_a2616ffdae2db993af5c08019fb61860a"><div class="ttname"><a href="namespacearmnn.xhtml#a2616ffdae2db993af5c08019fb61860a">armnn::InsertDebugLayerAfter</a></div><div class="ttdeci">std::vector< DebugLayer * > InsertDebugLayerAfter(Graph &graph, Layer &layer)</div><div class="ttdef"><b>Definition:</b> <a href="_network_utils_8cpp_source.xhtml#l00112">NetworkUtils.cpp:112</a></div></div> |
| 133 | <div class="ttc" id="_subgraph_view_selector_8hpp_xhtml"><div class="ttname"><a href="_subgraph_view_selector_8hpp.xhtml">SubgraphViewSelector.hpp</a></div></div> |
| 134 | <div class="ttc" id="classarmnn_1_1_output_slot_xhtml_ada2ad7d1caeeb4ef6195c8925fad6a65"><div class="ttname"><a href="classarmnn_1_1_output_slot.xhtml#ada2ad7d1caeeb4ef6195c8925fad6a65">armnn::OutputSlot::GetTensorInfo</a></div><div class="ttdeci">const TensorInfo & GetTensorInfo() const override</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8cpp_source.xhtml#l00063">Layer.cpp:63</a></div></div> |
| 135 | <div class="ttc" id="classarmnn_1_1_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml">armnn::Layer</a></div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00209">Layer.hpp:209</a></div></div> |
| 136 | </div><!-- fragment --></div><!-- contents --> |
| 137 | </div><!-- doc-content --> |
| 138 | <!-- start footer part --> |
| 139 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 140 | <ul> |
| 141 | <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_e0a84d05c80a2ef4231141dcbbeac5c8.xhtml">armnn</a></li><li class="navelem"><a class="el" href="_network_utils_8cpp.xhtml">NetworkUtils.cpp</a></li> |
| 142 | <li class="footer">Generated on Fri Mar 13 2020 16:09:08 for ArmNN by |
| 143 | <a href="http://www.doxygen.org/index.html"> |
| 144 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 145 | </ul> |
| 146 | </div> |
| 147 | </body> |
| 148 | </html> |