1 <!-- HTML header for doxygen 1.8.9.1-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7 <meta name="generator" content="Doxygen 1.8.11"/>
8 <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
9 <title>Compute Library: src/core/CL/cl_kernels/l2_normalize.cl File Reference</title>
10 <link href="tabs.css" rel="stylesheet" type="text/css"/>
11 <script type="text/javascript" src="jquery.js"></script>
12 <script type="text/javascript" src="dynsections.js"></script>
13 <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtreedata.js"></script>
16 <script type="text/javascript" src="navtree.js"></script>
17 <script type="text/javascript">
18 $(document).ready(initResizable);
19 $(window).load(resizeHeight);
21 <link href="search/search.css" rel="stylesheet" type="text/css"/>
22 <script type="text/javascript" src="search/searchdata.js"></script>
23 <script type="text/javascript" src="search/search.js"></script>
24 <script type="text/javascript">
25 $(document).ready(function() { init_search(); });
27 <script type="text/x-mathjax-config">
29 extensions: ["tex2jax.js"],
30 jax: ["input/TeX","output/HTML-CSS"],
32 </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
33 <link href="doxygen.css" rel="stylesheet" type="text/css" />
36 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
38 <table cellspacing="0" cellpadding="0">
40 <tr style="height: 56px;">
41 <td style="padding-left: 0.5em;">
42 <div id="projectname">Compute Library
43  <span id="projectnumber">18.03</span>
50 <!-- end header part -->
51 <!-- Generated by Doxygen 1.8.11 -->
52 <script type="text/javascript">
53 var searchBox = new SearchBox("searchBox", "search",false,'Search');
55 <div id="navrow1" class="tabs">
57 <li><a href="index.xhtml"><span>Main Page</span></a></li>
58 <li><a href="pages.xhtml"><span>Related Pages</span></a></li>
59 <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
60 <li><a href="annotated.xhtml"><span>Data Structures</span></a></li>
61 <li class="current"><a href="files.xhtml"><span>Files</span></a></li>
63 <div id="MSearchBox" class="MSearchBoxInactive">
65 <img id="MSearchSelect" src="search/mag_sel.png"
66 onmouseover="return searchBox.OnSearchSelectShow()"
67 onmouseout="return searchBox.OnSearchSelectHide()"
69 <input type="text" id="MSearchField" value="Search" accesskey="S"
70 onfocus="searchBox.OnSearchFieldFocus(true)"
71 onblur="searchBox.OnSearchFieldFocus(false)"
72 onkeyup="searchBox.OnSearchFieldChange(event)"/>
73 </span><span class="right">
74 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
80 <div id="navrow2" class="tabs2">
82 <li><a href="files.xhtml"><span>File List</span></a></li>
83 <li><a href="globals.xhtml"><span>Globals</span></a></li>
87 <div id="side-nav" class="ui-resizable side-nav-resizable">
89 <div id="nav-tree-contents">
90 <div id="nav-sync" class="sync"></div>
93 <div id="splitbar" style="-moz-user-select:none;"
94 class="ui-resizable-handle">
97 <script type="text/javascript">
98 $(document).ready(function(){initNavTree('l2__normalize_8cl.xhtml','');});
100 <div id="doc-content">
101 <!-- window showing the filter options -->
102 <div id="MSearchSelectWindow"
103 onmouseover="return searchBox.OnSearchSelectShow()"
104 onmouseout="return searchBox.OnSearchSelectHide()"
105 onkeydown="return searchBox.OnSearchSelectKey(event)">
108 <!-- iframe showing the search results (closed by default) -->
109 <div id="MSearchResultsWindow">
110 <iframe src="javascript:void(0)" frameborder="0"
111 name="MSearchResults" id="MSearchResults">
116 <div class="summary">
117 <a href="#func-members">Functions</a> </div>
118 <div class="headertitle">
119 <div class="title">l2_normalize.cl File Reference</div> </div>
121 <div class="contents">
122 <div class="textblock"><code>#include "<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>"</code><br />
124 <p><a href="l2__normalize_8cl_source.xhtml">Go to the source code of this file.</a></p>
125 <table class="memberdecls">
126 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
127 Functions</h2></td></tr>
128 <tr class="memitem:ab09ea0cc113c0aed126f90b6de71eb2d"><td class="memItemLeft" align="right" valign="top">__kernel void </td><td class="memItemRight" valign="bottom"><a class="el" href="l2__normalize_8cl.xhtml#ab09ea0cc113c0aed126f90b6de71eb2d">l2_normalize</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_offset_first_element_in_bytes, __global uchar *sum_ptr, uint sum_stride_x, uint sum_step_x, uint sum_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_offset_first_element_in_bytes, <a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> epsilon)</td></tr>
129 <tr class="memdesc:ab09ea0cc113c0aed126f90b6de71eb2d"><td class="mdescLeft"> </td><td class="mdescRight">This kernel performs reduction given an operation. <a href="#ab09ea0cc113c0aed126f90b6de71eb2d">More...</a><br /></td></tr>
130 <tr class="separator:ab09ea0cc113c0aed126f90b6de71eb2d"><td class="memSeparator" colspan="2"> </td></tr>
132 <h2 class="groupheader">Function Documentation</h2>
133 <a class="anchor" id="ab09ea0cc113c0aed126f90b6de71eb2d"></a>
134 <div class="memitem">
135 <div class="memproto">
136 <table class="memname">
138 <td class="memname">__kernel void l2_normalize </td>
140 <td class="paramtype">__global uchar * </td>
141 <td class="paramname"><em>src_ptr</em>, </td>
144 <td class="paramkey"></td>
146 <td class="paramtype">uint </td>
147 <td class="paramname"><em>src_stride_x</em>, </td>
150 <td class="paramkey"></td>
152 <td class="paramtype">uint </td>
153 <td class="paramname"><em>src_step_x</em>, </td>
156 <td class="paramkey"></td>
158 <td class="paramtype">uint </td>
159 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
162 <td class="paramkey"></td>
164 <td class="paramtype">__global uchar * </td>
165 <td class="paramname"><em>sum_ptr</em>, </td>
168 <td class="paramkey"></td>
170 <td class="paramtype">uint </td>
171 <td class="paramname"><em>sum_stride_x</em>, </td>
174 <td class="paramkey"></td>
176 <td class="paramtype">uint </td>
177 <td class="paramname"><em>sum_step_x</em>, </td>
180 <td class="paramkey"></td>
182 <td class="paramtype">uint </td>
183 <td class="paramname"><em>sum_offset_first_element_in_bytes</em>, </td>
186 <td class="paramkey"></td>
188 <td class="paramtype">__global uchar * </td>
189 <td class="paramname"><em>dst_ptr</em>, </td>
192 <td class="paramkey"></td>
194 <td class="paramtype">uint </td>
195 <td class="paramname"><em>dst_stride_x</em>, </td>
198 <td class="paramkey"></td>
200 <td class="paramtype">uint </td>
201 <td class="paramname"><em>dst_step_x</em>, </td>
204 <td class="paramkey"></td>
206 <td class="paramtype">uint </td>
207 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
210 <td class="paramkey"></td>
212 <td class="paramtype"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> </td>
213 <td class="paramname"><em>epsilon</em> </td>
221 </div><div class="memdoc">
223 <p>This kernel performs reduction given an operation. </p>
224 <dl class="section note"><dt>Note</dt><dd>The data type must be passed at compile time using -DDATA_TYPE: e.g. -DDATA_TYPE=float </dd>
226 The data size must be passed at compile time using -DDATA_SIZE e.g. -DDATA_SIZE=32</dd></dl>
227 <dl class="params"><dt>Parameters</dt><dd>
228 <table class="params">
229 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: QS8/F16/F32 </td></tr>
230 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
231 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
232 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
233 <tr><td class="paramdir">[in]</td><td class="paramname">sum_ptr</td><td>Pointer to the source tensor. Supported data types: QS8/F16/F32 </td></tr>
234 <tr><td class="paramdir">[in]</td><td class="paramname">sum_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
235 <tr><td class="paramdir">[in]</td><td class="paramname">sum_step_x</td><td>sum_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
236 <tr><td class="paramdir">[in]</td><td class="paramname">sum_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
237 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Supported data types: same as <code>src_ptr</code> </td></tr>
238 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
239 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
240 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
241 <tr><td class="paramdir">[in]</td><td class="paramname">epsilon</td><td>Epsilon value </td></tr>
246 <p>Definition at line <a class="el" href="l2__normalize_8cl_source.xhtml#l00045">45</a> of file <a class="el" href="l2__normalize_8cl_source.xhtml">l2_normalize.cl</a>.</p>
248 <p>References <a class="el" href="helpers_8h_source.xhtml#l00096">CONVERT_TO_VECTOR_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, <a class="el" href="_c_l_2_convolution_8cpp_source.xhtml#l00137">arm_compute::test::validation::dst</a>, <a class="el" href="helpers_8h_source.xhtml#l00134">Vector::ptr</a>, <a class="el" href="_c_l_2_convolution_8cpp_source.xhtml#l00147">arm_compute::test::validation::src</a>, <a class="el" href="reduction__operation_8cl_source.xhtml#l00052">sum()</a>, and <a class="el" href="fixed__point_8h_source.xhtml#l00093">VEC_DATA_TYPE</a>.</p>
249 <div class="fragment"><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> {</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <a class="code" href="struct_vector.xhtml">Vector</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a6743f0a130e8311e6f5b1a23df102472">src</a> = <a class="code" href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a>(src);</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <a class="code" href="struct_vector.xhtml">Vector</a> <a class="code" href="reduction__operation_8cl.xhtml#ab0df00f5333da51860deb93deb44a782">sum</a> = <a class="code" href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a>(sum);</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <a class="code" href="struct_vector.xhtml">Vector</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a> = <a class="code" href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a>(dst);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 16)</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  in = vload16(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)src.ptr);</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 16)</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  normalize_value = (<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 16))native_rsqrt(fmax(((__global DATA_TYPE *)sum.ptr)[0], epsilon));</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  vstore16(in * normalize_value, 0, (__global DATA_TYPE *)dst.ptr);</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> }<div class="ttc" id="struct_vector_xhtml"><div class="ttname"><a href="struct_vector.xhtml">Vector</a></div><div class="ttdoc">Structure to hold Vector information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00132">helpers.h:132</a></div></div>
250 <div class="ttc" id="helpers_8h_xhtml_a527bfdf5eeb306f1cf01c4a8e29f38e0"><div class="ttname"><a href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_VECTOR_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00096">helpers.h:96</a></div></div>
251 <div class="ttc" id="convolution3x3_8cl_xhtml_afb8c72ce35c4a1f4a2588d6573e54aa1"><div class="ttname"><a href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a></div><div class="ttdeci">#define DATA_TYPE</div><div class="ttdef"><b>Definition:</b> <a href="convolution3x3_8cl_source.xhtml#l00027">convolution3x3.cl:27</a></div></div>
252 <div class="ttc" id="reduction__operation_8cl_xhtml_ab0df00f5333da51860deb93deb44a782"><div class="ttname"><a href="reduction__operation_8cl.xhtml#ab0df00f5333da51860deb93deb44a782">sum</a></div><div class="ttdeci">DATA_TYPE sum(__global const DATA_TYPE *input)</div><div class="ttdoc">Calculate sum of a vector. </div><div class="ttdef"><b>Definition:</b> <a href="reduction__operation_8cl_source.xhtml#l00052">reduction_operation.cl:52</a></div></div>
253 <div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_adbf67dcee294e673cf796f1ed8aeb6a4"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">arm_compute::test::validation::dst</a></div><div class="ttdeci">CLTensor dst</div><div class="ttdef"><b>Definition:</b> <a href="_c_l_2_convolution_8cpp_source.xhtml#l00137">Convolution.cpp:137</a></div></div>
254 <div class="ttc" id="fixed__point_8h_xhtml_a36f754c05b6fddf6df0d8d0a74f8159f"><div class="ttname"><a href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a></div><div class="ttdeci">#define VEC_DATA_TYPE(type, size)</div><div class="ttdef"><b>Definition:</b> <a href="fixed__point_8h_source.xhtml#l00093">fixed_point.h:93</a></div></div>
255 <div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a6743f0a130e8311e6f5b1a23df102472"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a6743f0a130e8311e6f5b1a23df102472">arm_compute::test::validation::src</a></div><div class="ttdeci">convolution configure & src</div><div class="ttdef"><b>Definition:</b> <a href="_c_l_2_convolution_8cpp_source.xhtml#l00147">Convolution.cpp:147</a></div></div>
256 </div><!-- fragment -->
259 </div><!-- contents -->
260 </div><!-- doc-content -->
261 <!-- start footer part -->
262 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
264 <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.xhtml">core</a></li><li class="navelem"><a class="el" href="dir_8c278f79c760e5c5fbd911f9870614c1.xhtml">CL</a></li><li class="navelem"><a class="el" href="dir_25885286e9dad4fa105b7b25a8031bbf.xhtml">cl_kernels</a></li><li class="navelem"><a class="el" href="l2__normalize_8cl.xhtml">l2_normalize.cl</a></li>
265 <li class="footer">Generated on Fri Mar 2 2018 12:37:56 for Compute Library by
266 <a href="http://www.doxygen.org/index.html">
267 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>