<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Compute Library
-  <span id="projectnumber">18.02</span>
+  <span id="projectnumber">18.03</span>
</div>
</td>
</tr>
<div class="contents">
<a href="_utils_quantized_asymm_8h.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 (c) 2017 ARM Limited.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a copy</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * of this software and associated documentation files (the "Software"), to</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * deal in the Software without restriction, including without limitation the</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * sell copies of the Software, and to permit persons to whom the Software is</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> *</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * The above copyright notice and this permission notice shall be included in all</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * copies or substantial portions of the Software.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * SOFTWARE.</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> */</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#ifndef __ARM_COMPUTE_TEST_VALIDATION_UTILS_QUANTIZED_ASYMM_H__</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#define __ARM_COMPUTE_TEST_VALIDATION_UTILS_QUANTIZED_ASYMM_H__</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="preprocessor">#include <cstdint></span></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="keyword">namespace </span><a class="code" href="namespacearm__compute.xhtml">arm_compute</a></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="keyword">namespace </span>test</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> <span class="keyword">namespace </span>validation</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> {</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="namespacearm__compute_1_1test_1_1validation.xhtml#a5bab95cbeb5c6bf05049df7afd32d823"> 36</a></span> <span class="keyword">inline</span> int32_t <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a5bab95cbeb5c6bf05049df7afd32d823">asymm_rounding_divide_by_pow2</a>(int32_t x, <span class="keywordtype">int</span> exponent)</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="keyword">const</span> int32_t mask = (1 << exponent) - 1;</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keyword">const</span> int32_t <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a6cae310822a46019ba25a00ddb0f7e62">threshold</a> = (mask >> 1) + (x < 0 ? 1 : 0);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">return</span> (x >> exponent) + ((x & mask) > threshold ? 1 : 0);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> }</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="namespacearm__compute_1_1test_1_1validation.xhtml#aea27abcd3d58d627282320dfdd213596"> 44</a></span> <span class="keyword">inline</span> int32_t <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#aea27abcd3d58d627282320dfdd213596">asymm_int_mult</a>(int32_t <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#aac40b7097f2bda9274ae07fa33d15a79">a</a>, int32_t <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7b8004eef325a40dd43eb80755610fff">b</a>)</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>  <span class="keywordtype">bool</span> overflow = a == b && a == <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">std::numeric_limits<int32_t>::min</a>();</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  int64_t a_64(a);</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  int64_t b_64(b);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  int64_t ab_64 = a_64 * b_64;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  int32_t nudge = ab_64 >= 0 ? (1 << 30) : (1 - (1 << 30));</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  int32_t ab_x2_high32 = <span class="keyword">static_cast<</span>int32_t<span class="keyword">></span>((ab_64 + nudge) / (1ll << 31));</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">return</span> overflow ? <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">std::numeric_limits<int32_t>::max</a>() : ab_x2_high32;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> }</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> } <span class="comment">// namespace validation</span></div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> } <span class="comment">// namespace test</span></div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> } <span class="comment">// namespace arm_compute</span></div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="preprocessor">#endif </span><span class="comment">/* __ARM_COMPUTE_TEST_VALIDATION_UTILS_QUANTIZED_ASYMM_H__ */</span><span class="preprocessor"></span></div><div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a5bab95cbeb5c6bf05049df7afd32d823"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a5bab95cbeb5c6bf05049df7afd32d823">arm_compute::test::validation::asymm_rounding_divide_by_pow2</a></div><div class="ttdeci">int32_t asymm_rounding_divide_by_pow2(int32_t x, int exponent)</div><div class="ttdoc">Rounded to nearest division by a power-of-two. </div><div class="ttdef"><b>Definition:</b> <a href="_utils_quantized_asymm_8h_source.xhtml#l00036">UtilsQuantizedAsymm.h:36</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_aabcf39e3917f842dbc5fbb0d802f24d5"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">arm_compute::test::fixed_point_arithmetic::detail::min</a></div><div class="ttdeci">fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00884">FixedPoint.h:884</a></div></div>
-<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_aac40b7097f2bda9274ae07fa33d15a79"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#aac40b7097f2bda9274ae07fa33d15a79">arm_compute::test::validation::a</a></div><div class="ttdeci">CLTensor a</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_g_e_m_m_8cpp_source.xhtml#l00119">GEMM.cpp:119</a></div></div>
-<div class="ttc" id="namespacearm__compute_xhtml"><div class="ttname"><a href="namespacearm__compute.xhtml">arm_compute</a></div><div class="ttdoc">This file contains all available output stages for GEMMLowp on OpenCL. </div><div class="ttdef"><b>Definition:</b> <a href="01__library_8dox_source.xhtml#l00001">01_library.dox:1</a></div></div>
+<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_aac40b7097f2bda9274ae07fa33d15a79"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#aac40b7097f2bda9274ae07fa33d15a79">arm_compute::test::validation::a</a></div><div class="ttdeci">CLTensor a</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_g_e_m_m_8cpp_source.xhtml#l00121">GEMM.cpp:121</a></div></div>
+<div class="ttc" id="namespacearm__compute_xhtml"><div class="ttname"><a href="namespacearm__compute.xhtml">arm_compute</a></div><div class="ttdoc">This file contains all available output stages for GEMMLowp on OpenCL. </div><div class="ttdef"><b>Definition:</b> <a href="00__introduction_8dox_source.xhtml#l00001">00_introduction.dox:1</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_aea27abcd3d58d627282320dfdd213596"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#aea27abcd3d58d627282320dfdd213596">arm_compute::test::validation::asymm_int_mult</a></div><div class="ttdeci">int32_t asymm_int_mult(int32_t a, int32_t b)</div><div class="ttdoc">Multiplication of two integers. </div><div class="ttdef"><b>Definition:</b> <a href="_utils_quantized_asymm_8h_source.xhtml#l00044">UtilsQuantizedAsymm.h:44</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_ad91bb73431b4de1f4946ed949d444849"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">arm_compute::test::fixed_point_arithmetic::detail::max</a></div><div class="ttdeci">fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00889">FixedPoint.h:889</a></div></div>
-<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a7b8004eef325a40dd43eb80755610fff"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a7b8004eef325a40dd43eb80755610fff">arm_compute::test::validation::b</a></div><div class="ttdeci">CLTensor b</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_g_e_m_m_8cpp_source.xhtml#l00120">GEMM.cpp:120</a></div></div>
+<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a7b8004eef325a40dd43eb80755610fff"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a7b8004eef325a40dd43eb80755610fff">arm_compute::test::validation::b</a></div><div class="ttdeci">CLTensor b</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_g_e_m_m_8cpp_source.xhtml#l00122">GEMM.cpp:122</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_1_1reference_xhtml_a6cae310822a46019ba25a00ddb0f7e62"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a6cae310822a46019ba25a00ddb0f7e62">arm_compute::test::validation::reference::threshold</a></div><div class="ttdeci">SimpleTensor< T > threshold(const SimpleTensor< T > &src, T threshold, T false_value, T true_value, ThresholdType type, T upper)</div><div class="ttdef"><b>Definition:</b> <a href="reference_2_threshold_8cpp_source.xhtml#l00035">Threshold.cpp:35</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_59425e443f801f1f2fd8bbe4959a3ccf.xhtml">tests</a></li><li class="navelem"><a class="el" href="dir_e7c7b16542faa38cb4655ff1750d3604.xhtml">validation</a></li><li class="navelem"><a class="el" href="dir_46fdb196cebdbffe77dac340cde62f29.xhtml">reference</a></li><li class="navelem"><a class="el" href="_utils_quantized_asymm_8h.xhtml">UtilsQuantizedAsymm.h</a></li>
- <li class="footer">Generated on Thu Feb 22 2018 15:45:21 for Compute Library by
+ <li class="footer">Generated on Fri Mar 2 2018 12:37:55 for Compute Library by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>