Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 6 | <meta name="generator" content="Doxygen 1.8.13"/> |
| 7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 8 | <title>ArmNN: QAsymmU8QuantizationScheme Struct Reference</title> |
| 9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 10 | <script type="text/javascript" src="jquery.js"></script> |
| 11 | <script type="text/javascript" src="dynsections.js"></script> |
| 12 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 13 | <script type="text/javascript" src="resize.js"></script> |
| 14 | <script type="text/javascript" src="navtreedata.js"></script> |
| 15 | <script type="text/javascript" src="navtree.js"></script> |
| 16 | <script type="text/javascript"> |
| 17 | $(document).ready(initResizable); |
| 18 | </script> |
| 19 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 20 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 21 | <script type="text/javascript" src="search/search.js"></script> |
| 22 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 23 | </head> |
| 24 | <body> |
| 25 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 26 | <div id="titlearea"> |
| 27 | <table cellspacing="0" cellpadding="0"> |
| 28 | <tbody> |
| 29 | <tr style="height: 56px;"> |
| 30 | <td id="projectalign" style="padding-left: 0.5em;"> |
| 31 | <div id="projectname">ArmNN |
| 32 |  <span id="projectnumber">NotReleased</span> |
| 33 | </div> |
| 34 | </td> |
| 35 | </tr> |
| 36 | </tbody> |
| 37 | </table> |
| 38 | </div> |
| 39 | <!-- end header part --> |
| 40 | <!-- Generated by Doxygen 1.8.13 --> |
| 41 | <script type="text/javascript"> |
| 42 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 43 | </script> |
| 44 | <script type="text/javascript" src="menudata.js"></script> |
| 45 | <script type="text/javascript" src="menu.js"></script> |
| 46 | <script type="text/javascript"> |
| 47 | $(function() { |
| 48 | initMenu('',true,false,'search.php','Search'); |
| 49 | $(document).ready(function() { init_search(); }); |
| 50 | }); |
| 51 | </script> |
| 52 | <div id="main-nav"></div> |
| 53 | </div><!-- top --> |
| 54 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 55 | <div id="nav-tree"> |
| 56 | <div id="nav-tree-contents"> |
| 57 | <div id="nav-sync" class="sync"></div> |
| 58 | </div> |
| 59 | </div> |
| 60 | <div id="splitbar" style="-moz-user-select:none;" |
| 61 | class="ui-resizable-handle"> |
| 62 | </div> |
| 63 | </div> |
| 64 | <script type="text/javascript"> |
| 65 | $(document).ready(function(){initNavTree('structarmnn_1_1_q_asymm_u8_quantization_scheme.html','');}); |
| 66 | </script> |
| 67 | <div id="doc-content"> |
| 68 | <!-- window showing the filter options --> |
| 69 | <div id="MSearchSelectWindow" |
| 70 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 71 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 72 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 73 | </div> |
| 74 | |
| 75 | <!-- iframe showing the search results (closed by default) --> |
| 76 | <div id="MSearchResultsWindow"> |
| 77 | <iframe src="javascript:void(0)" frameborder="0" |
| 78 | name="MSearchResults" id="MSearchResults"> |
| 79 | </iframe> |
| 80 | </div> |
| 81 | |
| 82 | <div class="header"> |
| 83 | <div class="summary"> |
| 84 | <a href="#pub-methods">Public Member Functions</a> | |
| 85 | <a href="structarmnn_1_1_q_asymm_u8_quantization_scheme-members.html">List of all members</a> </div> |
| 86 | <div class="headertitle"> |
| 87 | <div class="title">QAsymmU8QuantizationScheme Struct Reference</div> </div> |
| 88 | </div><!--header--> |
| 89 | <div class="contents"> |
| 90 | |
| 91 | <p><code>#include <<a class="el" href="_network_quantization_scheme_8hpp_source.html">NetworkQuantizationScheme.hpp</a>></code></p> |
| 92 | <div class="dynheader"> |
| 93 | Inheritance diagram for QAsymmU8QuantizationScheme:</div> |
| 94 | <div class="dyncontent"> |
| 95 | <div class="center"> |
| 96 | <img src="structarmnn_1_1_q_asymm_u8_quantization_scheme.png" usemap="#QAsymmU8QuantizationScheme_map" alt=""/> |
| 97 | <map id="QAsymmU8QuantizationScheme_map" name="QAsymmU8QuantizationScheme_map"> |
| 98 | <area href="structarmnn_1_1_i_quantization_scheme.html" alt="IQuantizationScheme" shape="rect" coords="0,0,192,24"/> |
| 99 | </map> |
| 100 | </div></div> |
| 101 | <table class="memberdecls"> |
| 102 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> |
| 103 | Public Member Functions</h2></td></tr> |
| 104 | <tr class="memitem:a9fb07d8d7554a1502e732b8afa92040a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacearmnn.html#a9b8e5a95f8c061bbbcdb036915dcb61a">OffsetScalePair</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structarmnn_1_1_q_asymm_u8_quantization_scheme.html#a9fb07d8d7554a1502e732b8afa92040a">ComputeScheme</a> (double min, double max) const override</td></tr> |
| 105 | <tr class="separator:a9fb07d8d7554a1502e732b8afa92040a"><td class="memSeparator" colspan="2"> </td></tr> |
| 106 | <tr class="memitem:a1046eb36ff708a1b84f9a6bf0103fbc7"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structarmnn_1_1_q_asymm_u8_quantization_scheme.html#a1046eb36ff708a1b84f9a6bf0103fbc7">NumBits</a> () const override</td></tr> |
| 107 | <tr class="separator:a1046eb36ff708a1b84f9a6bf0103fbc7"><td class="memSeparator" colspan="2"> </td></tr> |
| 108 | <tr class="memitem:a57d67416d97cb7138e43656b43feb797"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structarmnn_1_1_q_asymm_u8_quantization_scheme.html#a57d67416d97cb7138e43656b43feb797">GetDataType</a> () const override</td></tr> |
| 109 | <tr class="separator:a57d67416d97cb7138e43656b43feb797"><td class="memSeparator" colspan="2"> </td></tr> |
| 110 | <tr class="inherit_header pub_methods_structarmnn_1_1_i_quantization_scheme"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_structarmnn_1_1_i_quantization_scheme')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="structarmnn_1_1_i_quantization_scheme.html">IQuantizationScheme</a></td></tr> |
| 111 | <tr class="memitem:ac7ce71800ca0ebb1222958717a834c9a inherit pub_methods_structarmnn_1_1_i_quantization_scheme"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="structarmnn_1_1_i_quantization_scheme.html#ac7ce71800ca0ebb1222958717a834c9a">~IQuantizationScheme</a> ()</td></tr> |
| 112 | <tr class="separator:ac7ce71800ca0ebb1222958717a834c9a inherit pub_methods_structarmnn_1_1_i_quantization_scheme"><td class="memSeparator" colspan="2"> </td></tr> |
| 113 | </table> |
| 114 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| 115 | <div class="textblock"> |
| 116 | <p class="definition">Definition at line <a class="el" href="_network_quantization_scheme_8hpp_source.html#l00029">29</a> of file <a class="el" href="_network_quantization_scheme_8hpp_source.html">NetworkQuantizationScheme.hpp</a>.</p> |
| 117 | </div><h2 class="groupheader">Member Function Documentation</h2> |
| 118 | <a id="a9fb07d8d7554a1502e732b8afa92040a"></a> |
| 119 | <h2 class="memtitle"><span class="permalink"><a href="#a9fb07d8d7554a1502e732b8afa92040a">◆ </a></span>ComputeScheme()</h2> |
| 120 | |
| 121 | <div class="memitem"> |
| 122 | <div class="memproto"> |
| 123 | <table class="mlabels"> |
| 124 | <tr> |
| 125 | <td class="mlabels-left"> |
| 126 | <table class="memname"> |
| 127 | <tr> |
| 128 | <td class="memname"><a class="el" href="namespacearmnn.html#a9b8e5a95f8c061bbbcdb036915dcb61a">OffsetScalePair</a> ComputeScheme </td> |
| 129 | <td>(</td> |
| 130 | <td class="paramtype">double </td> |
| 131 | <td class="paramname"><em>min</em>, </td> |
| 132 | </tr> |
| 133 | <tr> |
| 134 | <td class="paramkey"></td> |
| 135 | <td></td> |
| 136 | <td class="paramtype">double </td> |
| 137 | <td class="paramname"><em>max</em> </td> |
| 138 | </tr> |
| 139 | <tr> |
| 140 | <td></td> |
| 141 | <td>)</td> |
| 142 | <td></td><td> const</td> |
| 143 | </tr> |
| 144 | </table> |
| 145 | </td> |
| 146 | <td class="mlabels-right"> |
| 147 | <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> |
| 148 | </tr> |
| 149 | </table> |
| 150 | </div><div class="memdoc"> |
| 151 | |
| 152 | <p>Implements <a class="el" href="structarmnn_1_1_i_quantization_scheme.html#a6a5561395e9693f02258b49dfcc009b4">IQuantizationScheme</a>.</p> |
| 153 | |
| 154 | <p class="definition">Definition at line <a class="el" href="_network_quantization_scheme_8hpp_source.html#l00031">31</a> of file <a class="el" href="_network_quantization_scheme_8hpp_source.html">NetworkQuantizationScheme.hpp</a>.</p> |
| 155 | |
| 156 | <p class="reference">References <a class="el" href="structarmnn_1_1_i_quantization_scheme.html#a7ebe7ca1c6100440fcc130217f43561b">IQuantizationScheme::NumBits()</a>.</p> |
| 157 | |
| 158 | <p class="reference">Referenced by <a class="el" href="_network_quantizer_utils_8hpp_source.html#l00023">armnn::QuantizeConstant()</a>.</p> |
| 159 | <div class="fragment"><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>  <span class="keywordflow">if</span> (min > max)</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>  <span class="keywordflow">throw</span> InvalidArgumentException(<span class="stringliteral">"min > max will result in invalid quantization."</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="keywordtype">double</span> highest = (1 << <a class="code" href="structarmnn_1_1_q_asymm_u8_quantization_scheme.html#a1046eb36ff708a1b84f9a6bf0103fbc7">NumBits</a>()) - 1;</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  min = std::min(0.0, min); <span class="comment">// min <= 0.0</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  max = std::max(0.0, max); <span class="comment">// max >= 0.0</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="comment">// To avoid dividing by zero when quantizing a zero filled tensor</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">if</span> (min == 0.0 && max == 0.0)</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  {</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  max = 1.0;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  }</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="comment">// Assumes quantization range [0-highest]</span></div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">double</span> scale = (max-min) / highest;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordtype">double</span> offset = -min / scale;</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">// Clamp offset [0-highest]</span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  offset = std::max(0.0, std::min(highest, offset));</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> </div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">return</span> std::make_pair(static_cast<float>(scale), static_cast<int>(std::round(offset)));</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  }</div><div class="ttc" id="structarmnn_1_1_q_asymm_u8_quantization_scheme_html_a1046eb36ff708a1b84f9a6bf0103fbc7"><div class="ttname"><a href="structarmnn_1_1_q_asymm_u8_quantization_scheme.html#a1046eb36ff708a1b84f9a6bf0103fbc7">armnn::QAsymmU8QuantizationScheme::NumBits</a></div><div class="ttdeci">int NumBits() const override</div><div class="ttdef"><b>Definition:</b> <a href="_network_quantization_scheme_8hpp_source.html#l00059">NetworkQuantizationScheme.hpp:59</a></div></div> |
| 160 | </div><!-- fragment --> |
| 161 | </div> |
| 162 | </div> |
| 163 | <a id="a57d67416d97cb7138e43656b43feb797"></a> |
| 164 | <h2 class="memtitle"><span class="permalink"><a href="#a57d67416d97cb7138e43656b43feb797">◆ </a></span>GetDataType()</h2> |
| 165 | |
| 166 | <div class="memitem"> |
| 167 | <div class="memproto"> |
| 168 | <table class="mlabels"> |
| 169 | <tr> |
| 170 | <td class="mlabels-left"> |
| 171 | <table class="memname"> |
| 172 | <tr> |
| 173 | <td class="memname"><a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> GetDataType </td> |
| 174 | <td>(</td> |
| 175 | <td class="paramname"></td><td>)</td> |
| 176 | <td> const</td> |
| 177 | </tr> |
| 178 | </table> |
| 179 | </td> |
| 180 | <td class="mlabels-right"> |
| 181 | <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> |
| 182 | </tr> |
| 183 | </table> |
| 184 | </div><div class="memdoc"> |
| 185 | |
| 186 | <p>Implements <a class="el" href="structarmnn_1_1_i_quantization_scheme.html#ad23181f9f8fcc85758f62c49fc7ca23f">IQuantizationScheme</a>.</p> |
| 187 | |
| 188 | <p class="definition">Definition at line <a class="el" href="_network_quantization_scheme_8hpp_source.html#l00061">61</a> of file <a class="el" href="_network_quantization_scheme_8hpp_source.html">NetworkQuantizationScheme.hpp</a>.</p> |
| 189 | |
| 190 | <p class="reference">References <a class="el" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e">armnn::QAsymmU8</a>.</p> |
| 191 | <div class="fragment"><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> { <span class="keywordflow">return</span> <a class="code" href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e">DataType::QAsymmU8</a>; }</div><div class="ttc" id="namespacearmnn_html_ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e"><div class="ttname"><a href="namespacearmnn.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0a3f57c876f5a230244c38e1453a8a6e">armnn::DataType::QAsymmU8</a></div></div> |
| 192 | </div><!-- fragment --> |
| 193 | </div> |
| 194 | </div> |
| 195 | <a id="a1046eb36ff708a1b84f9a6bf0103fbc7"></a> |
| 196 | <h2 class="memtitle"><span class="permalink"><a href="#a1046eb36ff708a1b84f9a6bf0103fbc7">◆ </a></span>NumBits()</h2> |
| 197 | |
| 198 | <div class="memitem"> |
| 199 | <div class="memproto"> |
| 200 | <table class="mlabels"> |
| 201 | <tr> |
| 202 | <td class="mlabels-left"> |
| 203 | <table class="memname"> |
| 204 | <tr> |
| 205 | <td class="memname">int NumBits </td> |
| 206 | <td>(</td> |
| 207 | <td class="paramname"></td><td>)</td> |
| 208 | <td> const</td> |
| 209 | </tr> |
| 210 | </table> |
| 211 | </td> |
| 212 | <td class="mlabels-right"> |
| 213 | <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> |
| 214 | </tr> |
| 215 | </table> |
| 216 | </div><div class="memdoc"> |
| 217 | |
| 218 | <p>Implements <a class="el" href="structarmnn_1_1_i_quantization_scheme.html#a7ebe7ca1c6100440fcc130217f43561b">IQuantizationScheme</a>.</p> |
| 219 | |
| 220 | <p class="definition">Definition at line <a class="el" href="_network_quantization_scheme_8hpp_source.html#l00059">59</a> of file <a class="el" href="_network_quantization_scheme_8hpp_source.html">NetworkQuantizationScheme.hpp</a>.</p> |
| 221 | <div class="fragment"><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> { <span class="keywordflow">return</span> 8; }</div></div><!-- fragment --> |
| 222 | </div> |
| 223 | </div> |
| 224 | <hr/>The documentation for this struct was generated from the following file:<ul> |
| 225 | <li>src/armnn/<a class="el" href="_network_quantization_scheme_8hpp_source.html">NetworkQuantizationScheme.hpp</a></li> |
| 226 | </ul> |
| 227 | </div><!-- contents --> |
| 228 | </div><!-- doc-content --> |
| 229 | <!-- start footer part --> |
| 230 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 231 | <ul> |
| 232 | <li class="navelem"><a class="el" href="namespacearmnn.html">armnn</a></li><li class="navelem"><a class="el" href="structarmnn_1_1_q_asymm_u8_quantization_scheme.html">QAsymmU8QuantizationScheme</a></li> |
| 233 | <li class="footer">Generated on Fri Mar 13 2020 16:07:04 for ArmNN by |
| 234 | <a href="http://www.doxygen.org/index.html"> |
| 235 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 236 | </ul> |
| 237 | </div> |
| 238 | </body> |
| 239 | </html> |