arm_compute v18.05
[platform/upstream/armcl.git] / documentation / pooling__layer_8cl.xhtml
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">
4 <head>
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/pooling_layer.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);
20 </script>
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(); });
26 </script>
27 <script type="text/x-mathjax-config">
28   MathJax.Hub.Config({
29     extensions: ["tex2jax.js"],
30     jax: ["input/TeX","output/HTML-CSS"],
31 });
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" />
34 </head>
35 <body>
36 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
37 <div id="titlearea">
38 <table cellspacing="0" cellpadding="0">
39  <tbody>
40  <tr style="height: 56px;">
41   <td style="padding-left: 0.5em;">
42    <div id="projectname">Compute Library
43    &#160;<span id="projectnumber">18.05</span>
44    </div>
45   </td>
46  </tr>
47  </tbody>
48 </table>
49 </div>
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');
54 </script>
55   <div id="navrow1" class="tabs">
56     <ul class="tablist">
57       <li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
58       <li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
59       <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
60       <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
61       <li class="current"><a href="files.xhtml"><span>Files</span></a></li>
62       <li>
63         <div id="MSearchBox" class="MSearchBoxInactive">
64         <span class="left">
65           <img id="MSearchSelect" src="search/mag_sel.png"
66                onmouseover="return searchBox.OnSearchSelectShow()"
67                onmouseout="return searchBox.OnSearchSelectHide()"
68                alt=""/>
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>
75           </span>
76         </div>
77       </li>
78     </ul>
79   </div>
80   <div id="navrow2" class="tabs2">
81     <ul class="tablist">
82       <li><a href="files.xhtml"><span>File&#160;List</span></a></li>
83       <li><a href="globals.xhtml"><span>Globals</span></a></li>
84     </ul>
85   </div>
86 </div><!-- top -->
87 <div id="side-nav" class="ui-resizable side-nav-resizable">
88   <div id="nav-tree">
89     <div id="nav-tree-contents">
90       <div id="nav-sync" class="sync"></div>
91     </div>
92   </div>
93   <div id="splitbar" style="-moz-user-select:none;" 
94        class="ui-resizable-handle">
95   </div>
96 </div>
97 <script type="text/javascript">
98 $(document).ready(function(){initNavTree('pooling__layer_8cl.xhtml','');});
99 </script>
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)">
106 </div>
107
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">
112 </iframe>
113 </div>
114
115 <div class="header">
116   <div class="summary">
117 <a href="#define-members">Macros</a> &#124;
118 <a href="#func-members">Functions</a>  </div>
119   <div class="headertitle">
120 <div class="title">pooling_layer.cl File Reference</div>  </div>
121 </div><!--header-->
122 <div class="contents">
123 <div class="textblock"><code>#include &quot;<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>&quot;</code><br />
124 </div>
125 <p><a href="pooling__layer_8cl_source.xhtml">Go to the source code of this file.</a></p>
126 <table class="memberdecls">
127 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
128 Macros</h2></td></tr>
129 <tr class="memitem:a482ef7d59a5f474ca126e737c7f0978a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(x,  y)&#160;&#160;&#160;((x) + (y))</td></tr>
130 <tr class="separator:a482ef7d59a5f474ca126e737c7f0978a"><td class="memSeparator" colspan="2">&#160;</td></tr>
131 <tr class="memitem:a03898439d164d74f8c35bafb67262d95"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(x,  vec_size)&#160;&#160;&#160;(x)</td></tr>
132 <tr class="separator:a03898439d164d74f8c35bafb67262d95"><td class="memSeparator" colspan="2">&#160;</td></tr>
133 <tr class="memitem:a5db17889d824975fefb2ce2f4690637f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a>(x,  y)&#160;&#160;&#160;(x * (1.f / y))</td></tr>
134 <tr class="separator:a5db17889d824975fefb2ce2f4690637f"><td class="memSeparator" colspan="2">&#160;</td></tr>
135 <tr class="memitem:ac9af19bec38fe50b4b9585c0e5c0ccca"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(x)&#160;&#160;&#160;sqrt((x))</td></tr>
136 <tr class="separator:ac9af19bec38fe50b4b9585c0e5c0ccca"><td class="memSeparator" colspan="2">&#160;</td></tr>
137 <tr class="memitem:a6c01fa98d360a9d52926dc6a5a599711"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a6c01fa98d360a9d52926dc6a5a599711">DIV_OP_NHWC</a>(x,  y)&#160;&#160;&#160;(x * (<a class="el" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8))(1.f / y))</td></tr>
138 <tr class="separator:a6c01fa98d360a9d52926dc6a5a599711"><td class="memSeparator" colspan="2">&#160;</td></tr>
139 <tr class="memitem:a6b8e66069b8cd3e743141d7f024a7d76"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a6b8e66069b8cd3e743141d7f024a7d76">POOLING3x3_STRIDE1</a>(res,  input,  output)</td></tr>
140 <tr class="separator:a6b8e66069b8cd3e743141d7f024a7d76"><td class="memSeparator" colspan="2">&#160;</td></tr>
141 <tr class="memitem:abb8f7128361a6a1965b1b2a5b3a719b2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#abb8f7128361a6a1965b1b2a5b3a719b2">POOLING3x3_STRIDE2</a>(res,  input,  output)</td></tr>
142 <tr class="separator:abb8f7128361a6a1965b1b2a5b3a719b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
143 <tr class="memitem:aba30215e4df370ff8935f83046e696ea"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#aba30215e4df370ff8935f83046e696ea">POOLING3x3_STRIDE3</a>(res,  input,  output)</td></tr>
144 <tr class="separator:aba30215e4df370ff8935f83046e696ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
145 </table><table class="memberdecls">
146 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
147 Functions</h2></td></tr>
148 <tr class="memitem:ac8f27d6ce33043a58fc6bd17b41f8153"><td class="memItemLeft" align="right" valign="top"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#ac8f27d6ce33043a58fc6bd17b41f8153">calculate_avg_scale</a> (const int pool_size_x, const int pool_size_y, const int upper_bound_w, const int upper_bound_h, const int pad_x, const int pad_y, const int stride_x, const int stride_y)</td></tr>
149 <tr class="separator:ac8f27d6ce33043a58fc6bd17b41f8153"><td class="memSeparator" colspan="2">&#160;</td></tr>
150 <tr class="memitem:a2d95de36199fd06803ffb62f5ff1df08"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a2d95de36199fd06803ffb62f5ff1df08">pooling_layer_2</a> (__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_stride_z, uint input_step_z, uint input_offset_first_element_in_bytes, __global uchar *output_ptr, uint output_stride_x, uint output_step_x, uint output_stride_y, uint output_step_y, uint output_stride_z, uint output_step_z, uint output_offset_first_element_in_bytes)</td></tr>
151 <tr class="memdesc:a2d95de36199fd06803ffb62f5ff1df08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a pooling function of pool size equal to 2.  <a href="#a2d95de36199fd06803ffb62f5ff1df08">More...</a><br /></td></tr>
152 <tr class="separator:a2d95de36199fd06803ffb62f5ff1df08"><td class="memSeparator" colspan="2">&#160;</td></tr>
153 <tr class="memitem:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#af5751970a4d8c62febdc6c63d6d4fd1d">pooling_layer_3</a> (__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_stride_z, uint input_step_z, uint input_offset_first_element_in_bytes, __global uchar *output_ptr, uint output_stride_x, uint output_step_x, uint output_stride_y, uint output_step_y, uint output_stride_z, uint output_step_z, uint output_offset_first_element_in_bytes)</td></tr>
154 <tr class="memdesc:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a pooling function of pool size equal to 3.  <a href="#af5751970a4d8c62febdc6c63d6d4fd1d">More...</a><br /></td></tr>
155 <tr class="separator:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
156 <tr class="memitem:a93173b51e52924504320e874affcf881"><td class="memItemLeft" align="right" valign="top"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a93173b51e52924504320e874affcf881">calculate_avg_scale_nhwc</a> (const int pool_size_x, const int pool_size_y, int upper_bound_w, int upper_bound_h, const int pad_x, const int pad_y, const int stride_x, const int stride_y)</td></tr>
157 <tr class="separator:a93173b51e52924504320e874affcf881"><td class="memSeparator" colspan="2">&#160;</td></tr>
158 <tr class="memitem:ac320fea94a0f786ca35fe159d57a6e49"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#ac320fea94a0f786ca35fe159d57a6e49">pooling_layer_MxN_nhwc</a> (__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_stride_z, uint input_step_z, uint input_offset_first_element_in_bytes, __global uchar *output_ptr, uint output_stride_x, uint output_step_x, uint output_stride_y, uint output_step_y, uint output_stride_z, uint output_step_z, uint output_offset_first_element_in_bytes)</td></tr>
159 <tr class="memdesc:ac320fea94a0f786ca35fe159d57a6e49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a pooling function of pool size equal to N (NHWC)  <a href="#ac320fea94a0f786ca35fe159d57a6e49">More...</a><br /></td></tr>
160 <tr class="separator:ac320fea94a0f786ca35fe159d57a6e49"><td class="memSeparator" colspan="2">&#160;</td></tr>
161 </table>
162 <h2 class="groupheader">Macro Definition Documentation</h2>
163 <a class="anchor" id="a5db17889d824975fefb2ce2f4690637f"></a>
164 <div class="memitem">
165 <div class="memproto">
166       <table class="memname">
167         <tr>
168           <td class="memname">#define DIV_OP</td>
169           <td>(</td>
170           <td class="paramtype">&#160;</td>
171           <td class="paramname">x, </td>
172         </tr>
173         <tr>
174           <td class="paramkey"></td>
175           <td></td>
176           <td class="paramtype">&#160;</td>
177           <td class="paramname">y&#160;</td>
178         </tr>
179         <tr>
180           <td></td>
181           <td>)</td>
182           <td></td><td>&#160;&#160;&#160;(x * (1.f / y))</td>
183         </tr>
184       </table>
185 </div><div class="memdoc">
186
187 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00060">60</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
188
189 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00228">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00292">pooling_layer_3()</a>.</p>
190
191 </div>
192 </div>
193 <a class="anchor" id="a6c01fa98d360a9d52926dc6a5a599711"></a>
194 <div class="memitem">
195 <div class="memproto">
196       <table class="memname">
197         <tr>
198           <td class="memname">#define DIV_OP_NHWC</td>
199           <td>(</td>
200           <td class="paramtype">&#160;</td>
201           <td class="paramname">x, </td>
202         </tr>
203         <tr>
204           <td class="paramkey"></td>
205           <td></td>
206           <td class="paramtype">&#160;</td>
207           <td class="paramname">y&#160;</td>
208         </tr>
209         <tr>
210           <td></td>
211           <td>)</td>
212           <td></td><td>&#160;&#160;&#160;(x * (<a class="el" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8))(1.f / y))</td>
213         </tr>
214       </table>
215 </div><div class="memdoc">
216
217 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00065">65</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
218
219 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">pooling_layer_MxN_nhwc()</a>.</p>
220
221 </div>
222 </div>
223 <a class="anchor" id="a482ef7d59a5f474ca126e737c7f0978a"></a>
224 <div class="memitem">
225 <div class="memproto">
226       <table class="memname">
227         <tr>
228           <td class="memname">#define POOL_OP</td>
229           <td>(</td>
230           <td class="paramtype">&#160;</td>
231           <td class="paramname">x, </td>
232         </tr>
233         <tr>
234           <td class="paramkey"></td>
235           <td></td>
236           <td class="paramtype">&#160;</td>
237           <td class="paramname">y&#160;</td>
238         </tr>
239         <tr>
240           <td></td>
241           <td>)</td>
242           <td></td><td>&#160;&#160;&#160;((x) + (y))</td>
243         </tr>
244       </table>
245 </div><div class="memdoc">
246
247 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00049">49</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
248
249 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00228">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00292">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">pooling_layer_MxN_nhwc()</a>.</p>
250
251 </div>
252 </div>
253 <a class="anchor" id="a6b8e66069b8cd3e743141d7f024a7d76"></a>
254 <div class="memitem">
255 <div class="memproto">
256       <table class="memname">
257         <tr>
258           <td class="memname">#define POOLING3x3_STRIDE1</td>
259           <td>(</td>
260           <td class="paramtype">&#160;</td>
261           <td class="paramname">res, </td>
262         </tr>
263         <tr>
264           <td class="paramkey"></td>
265           <td></td>
266           <td class="paramtype">&#160;</td>
267           <td class="paramname">input, </td>
268         </tr>
269         <tr>
270           <td class="paramkey"></td>
271           <td></td>
272           <td class="paramtype">&#160;</td>
273           <td class="paramname">output&#160;</td>
274         </tr>
275         <tr>
276           <td></td>
277           <td>)</td>
278           <td></td><td></td>
279         </tr>
280       </table>
281 </div><div class="memdoc">
282
283 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00075">75</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
284
285 </div>
286 </div>
287 <a class="anchor" id="abb8f7128361a6a1965b1b2a5b3a719b2"></a>
288 <div class="memitem">
289 <div class="memproto">
290       <table class="memname">
291         <tr>
292           <td class="memname">#define POOLING3x3_STRIDE2</td>
293           <td>(</td>
294           <td class="paramtype">&#160;</td>
295           <td class="paramname">res, </td>
296         </tr>
297         <tr>
298           <td class="paramkey"></td>
299           <td></td>
300           <td class="paramtype">&#160;</td>
301           <td class="paramname">input, </td>
302         </tr>
303         <tr>
304           <td class="paramkey"></td>
305           <td></td>
306           <td class="paramtype">&#160;</td>
307           <td class="paramname">output&#160;</td>
308         </tr>
309         <tr>
310           <td></td>
311           <td>)</td>
312           <td></td><td></td>
313         </tr>
314       </table>
315 </div><div class="memdoc">
316
317 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00118">118</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
318
319 </div>
320 </div>
321 <a class="anchor" id="aba30215e4df370ff8935f83046e696ea"></a>
322 <div class="memitem">
323 <div class="memproto">
324       <table class="memname">
325         <tr>
326           <td class="memname">#define POOLING3x3_STRIDE3</td>
327           <td>(</td>
328           <td class="paramtype">&#160;</td>
329           <td class="paramname">res, </td>
330         </tr>
331         <tr>
332           <td class="paramkey"></td>
333           <td></td>
334           <td class="paramtype">&#160;</td>
335           <td class="paramname">input, </td>
336         </tr>
337         <tr>
338           <td class="paramkey"></td>
339           <td></td>
340           <td class="paramtype">&#160;</td>
341           <td class="paramname">output&#160;</td>
342         </tr>
343         <tr>
344           <td></td>
345           <td>)</td>
346           <td></td><td></td>
347         </tr>
348       </table>
349 </div><div class="memdoc">
350 <b>Value:</b><div class="fragment"><div class="line">({                                                                                                                               <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div><div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">        VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)                                                                                                  \</div><div class="line">        data00 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0));                                                  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div><div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">        VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4)                                                                                                  \</div><div class="line">        data01 = vload4(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0) + 8);                                              <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div><div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">        VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)                                                                                                  \</div><div class="line">        data10 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0));                                                  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div><div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">        VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4)                                                                                                  \</div><div class="line">        data11 = vload4(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0) + 8);                                              <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div><div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">        VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)                                                                                                  \</div><div class="line">        data20 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0));                                                  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div><div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">        VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4)                                                                                                  \</div><div class="line">        data21 = vload4(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0) + 8);                                              \</div><div class="line">        data00 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data00, 8);                                                                                                 \</div><div class="line">        data01 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data01, 4);                                                                                                 \</div><div class="line">        data10 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data10, 8);                                                                                                 \</div><div class="line">        data11 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data11, 4);                                                                                                 \</div><div class="line">        data20 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data20, 8);                                                                                                 \</div><div class="line">        data21 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data21, 4);                                                                                                 \</div><div class="line">        \</div><div class="line">        data00 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data00, data10);                                                                                            \</div><div class="line">        data01 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data01, data11);                                                                                            \</div><div class="line">        data00 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data00, data20);                                                                                            \</div><div class="line">        data01 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data01, data21);                                                                                            \</div><div class="line">        \</div><div class="line">        res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>((<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4))(data00.s036, data01.s1), (<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4))(data00.s147, data01.s2)); \</div><div class="line">        res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(res, (<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4))(data00.s25, data01.s03));                                                   \</div><div class="line">    })</div><div class="ttc" id="pooling__layer_8cl_xhtml_a482ef7d59a5f474ca126e737c7f0978a"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a></div><div class="ttdeci">#define POOL_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00049">pooling_layer.cl:49</a></div></div>
351 <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>
352 <div class="ttc" id="pooling__layer_8cl_xhtml_a03898439d164d74f8c35bafb67262d95"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a></div><div class="ttdeci">#define POW2_OP(x, vec_size)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00057">pooling_layer.cl:57</a></div></div>
353 <div class="ttc" id="helpers_8h_xhtml_a2101b2fe0193ce227ae4e0945e321d85"><div class="ttname"><a href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a></div><div class="ttdeci">__global const uchar * tensor3D_offset(const Tensor3D *tensor, int x, int y, int z)</div><div class="ttdoc">Get the pointer position of a Tensor3D. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00315">helpers.h:315</a></div></div>
354 <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>
355 </div><!-- fragment -->
356 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00158">158</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
357
358 </div>
359 </div>
360 <a class="anchor" id="a03898439d164d74f8c35bafb67262d95"></a>
361 <div class="memitem">
362 <div class="memproto">
363       <table class="memname">
364         <tr>
365           <td class="memname">#define POW2_OP</td>
366           <td>(</td>
367           <td class="paramtype">&#160;</td>
368           <td class="paramname">x, </td>
369         </tr>
370         <tr>
371           <td class="paramkey"></td>
372           <td></td>
373           <td class="paramtype">&#160;</td>
374           <td class="paramname">vec_size&#160;</td>
375         </tr>
376         <tr>
377           <td></td>
378           <td>)</td>
379           <td></td><td>&#160;&#160;&#160;(x)</td>
380         </tr>
381       </table>
382 </div><div class="memdoc">
383
384 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00057">57</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
385
386 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00228">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00292">pooling_layer_3()</a>.</p>
387
388 </div>
389 </div>
390 <a class="anchor" id="ac9af19bec38fe50b4b9585c0e5c0ccca"></a>
391 <div class="memitem">
392 <div class="memproto">
393       <table class="memname">
394         <tr>
395           <td class="memname">#define SQRT_OP</td>
396           <td>(</td>
397           <td class="paramtype">&#160;</td>
398           <td class="paramname">x</td><td>)</td>
399           <td>&#160;&#160;&#160;sqrt((x))</td>
400         </tr>
401       </table>
402 </div><div class="memdoc">
403
404 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">61</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
405
406 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00228">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00292">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">pooling_layer_MxN_nhwc()</a>.</p>
407
408 </div>
409 </div>
410 <h2 class="groupheader">Function Documentation</h2>
411 <a class="anchor" id="ac8f27d6ce33043a58fc6bd17b41f8153"></a>
412 <div class="memitem">
413 <div class="memproto">
414       <table class="memname">
415         <tr>
416           <td class="memname"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> calculate_avg_scale </td>
417           <td>(</td>
418           <td class="paramtype">const int&#160;</td>
419           <td class="paramname"><em>pool_size_x</em>, </td>
420         </tr>
421         <tr>
422           <td class="paramkey"></td>
423           <td></td>
424           <td class="paramtype">const int&#160;</td>
425           <td class="paramname"><em>pool_size_y</em>, </td>
426         </tr>
427         <tr>
428           <td class="paramkey"></td>
429           <td></td>
430           <td class="paramtype">const int&#160;</td>
431           <td class="paramname"><em>upper_bound_w</em>, </td>
432         </tr>
433         <tr>
434           <td class="paramkey"></td>
435           <td></td>
436           <td class="paramtype">const int&#160;</td>
437           <td class="paramname"><em>upper_bound_h</em>, </td>
438         </tr>
439         <tr>
440           <td class="paramkey"></td>
441           <td></td>
442           <td class="paramtype">const int&#160;</td>
443           <td class="paramname"><em>pad_x</em>, </td>
444         </tr>
445         <tr>
446           <td class="paramkey"></td>
447           <td></td>
448           <td class="paramtype">const int&#160;</td>
449           <td class="paramname"><em>pad_y</em>, </td>
450         </tr>
451         <tr>
452           <td class="paramkey"></td>
453           <td></td>
454           <td class="paramtype">const int&#160;</td>
455           <td class="paramname"><em>stride_x</em>, </td>
456         </tr>
457         <tr>
458           <td class="paramkey"></td>
459           <td></td>
460           <td class="paramtype">const int&#160;</td>
461           <td class="paramname"><em>stride_y</em>&#160;</td>
462         </tr>
463         <tr>
464           <td></td>
465           <td>)</td>
466           <td></td><td></td>
467         </tr>
468       </table>
469 </div><div class="memdoc">
470
471 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00188">188</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
472
473 <p>References <a class="el" href="tests_2validation_2_fixed_point_8h_source.xhtml#l00902">arm_compute::test::fixed_point_arithmetic::detail::max()</a>, and <a class="el" href="tests_2validation_2_fixed_point_8h_source.xhtml#l00897">arm_compute::test::fixed_point_arithmetic::detail::min()</a>.</p>
474
475 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00228">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00292">pooling_layer_3()</a>.</p>
476 <div class="fragment"><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;{</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="keywordtype">int</span>       start_x = get_global_id(0) * stride_x - pad_x;</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="keywordtype">int</span>       start_y = get_global_id(1) * stride_y - pad_y;</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> end_x   = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">min</a>(start_x + pool_size_x, upper_bound_w);</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> end_y   = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">min</a>(start_y + pool_size_y, upper_bound_h);</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;<span class="preprocessor">#if defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    start_x = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">max</a>(0, start_x);</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    start_y = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">max</a>(0, start_y);</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(EXCLUDE_PADDING) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">return</span> ((end_y - start_y) * (end_x - start_x));</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;}</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&lt; T &gt; min(fixed_point&lt; T &gt; x, fixed_point&lt; T &gt; y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00897">FixedPoint.h:897</a></div></div>
477 <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&lt; T &gt; max(fixed_point&lt; T &gt; x, fixed_point&lt; T &gt; y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00902">FixedPoint.h:902</a></div></div>
478 </div><!-- fragment -->
479 </div>
480 </div>
481 <a class="anchor" id="a93173b51e52924504320e874affcf881"></a>
482 <div class="memitem">
483 <div class="memproto">
484       <table class="memname">
485         <tr>
486           <td class="memname"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> calculate_avg_scale_nhwc </td>
487           <td>(</td>
488           <td class="paramtype">const int&#160;</td>
489           <td class="paramname"><em>pool_size_x</em>, </td>
490         </tr>
491         <tr>
492           <td class="paramkey"></td>
493           <td></td>
494           <td class="paramtype">const int&#160;</td>
495           <td class="paramname"><em>pool_size_y</em>, </td>
496         </tr>
497         <tr>
498           <td class="paramkey"></td>
499           <td></td>
500           <td class="paramtype">int&#160;</td>
501           <td class="paramname"><em>upper_bound_w</em>, </td>
502         </tr>
503         <tr>
504           <td class="paramkey"></td>
505           <td></td>
506           <td class="paramtype">int&#160;</td>
507           <td class="paramname"><em>upper_bound_h</em>, </td>
508         </tr>
509         <tr>
510           <td class="paramkey"></td>
511           <td></td>
512           <td class="paramtype">const int&#160;</td>
513           <td class="paramname"><em>pad_x</em>, </td>
514         </tr>
515         <tr>
516           <td class="paramkey"></td>
517           <td></td>
518           <td class="paramtype">const int&#160;</td>
519           <td class="paramname"><em>pad_y</em>, </td>
520         </tr>
521         <tr>
522           <td class="paramkey"></td>
523           <td></td>
524           <td class="paramtype">const int&#160;</td>
525           <td class="paramname"><em>stride_x</em>, </td>
526         </tr>
527         <tr>
528           <td class="paramkey"></td>
529           <td></td>
530           <td class="paramtype">const int&#160;</td>
531           <td class="paramname"><em>stride_y</em>&#160;</td>
532         </tr>
533         <tr>
534           <td></td>
535           <td>)</td>
536           <td></td><td></td>
537         </tr>
538       </table>
539 </div><div class="memdoc">
540
541 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00518">518</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
542
543 <p>References <a class="el" href="tests_2validation_2_fixed_point_8h_source.xhtml#l00902">arm_compute::test::fixed_point_arithmetic::detail::max()</a>, and <a class="el" href="tests_2validation_2_fixed_point_8h_source.xhtml#l00897">arm_compute::test::fixed_point_arithmetic::detail::min()</a>.</p>
544
545 <p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">pooling_layer_MxN_nhwc()</a>.</p>
546 <div class="fragment"><div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;{</div><div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;    <span class="keywordtype">int</span> start_x = get_global_id(1) * stride_x - pad_x;</div><div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;    <span class="keywordtype">int</span> start_y = get_global_id(2) * stride_y - pad_y;</div><div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;</div><div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;<span class="preprocessor">#if !defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;    upper_bound_w += pad_x;</div><div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;    upper_bound_h += pad_y;</div><div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(EXCLUDE_PADDING) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> end_x = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">min</a>(start_x + pool_size_x, upper_bound_w);</div><div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> end_y = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">min</a>(start_y + pool_size_y, upper_bound_h);</div><div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;<span class="preprocessor">#if defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;    start_x = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">max</a>(0, start_x);</div><div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;    start_y = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">max</a>(0, start_y);</div><div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(EXCLUDE_PADDING) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;    <span class="keywordflow">return</span> ((end_y - start_y) * (end_x - start_x));</div><div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;}</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&lt; T &gt; min(fixed_point&lt; T &gt; x, fixed_point&lt; T &gt; y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00897">FixedPoint.h:897</a></div></div>
547 <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&lt; T &gt; max(fixed_point&lt; T &gt; x, fixed_point&lt; T &gt; y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00902">FixedPoint.h:902</a></div></div>
548 </div><!-- fragment -->
549 </div>
550 </div>
551 <a class="anchor" id="a2d95de36199fd06803ffb62f5ff1df08"></a>
552 <div class="memitem">
553 <div class="memproto">
554       <table class="memname">
555         <tr>
556           <td class="memname">__kernel void pooling_layer_2 </td>
557           <td>(</td>
558           <td class="paramtype">__global uchar *&#160;</td>
559           <td class="paramname"><em>input_ptr</em>, </td>
560         </tr>
561         <tr>
562           <td class="paramkey"></td>
563           <td></td>
564           <td class="paramtype">uint&#160;</td>
565           <td class="paramname"><em>input_stride_x</em>, </td>
566         </tr>
567         <tr>
568           <td class="paramkey"></td>
569           <td></td>
570           <td class="paramtype">uint&#160;</td>
571           <td class="paramname"><em>input_step_x</em>, </td>
572         </tr>
573         <tr>
574           <td class="paramkey"></td>
575           <td></td>
576           <td class="paramtype">uint&#160;</td>
577           <td class="paramname"><em>input_stride_y</em>, </td>
578         </tr>
579         <tr>
580           <td class="paramkey"></td>
581           <td></td>
582           <td class="paramtype">uint&#160;</td>
583           <td class="paramname"><em>input_step_y</em>, </td>
584         </tr>
585         <tr>
586           <td class="paramkey"></td>
587           <td></td>
588           <td class="paramtype">uint&#160;</td>
589           <td class="paramname"><em>input_stride_z</em>, </td>
590         </tr>
591         <tr>
592           <td class="paramkey"></td>
593           <td></td>
594           <td class="paramtype">uint&#160;</td>
595           <td class="paramname"><em>input_step_z</em>, </td>
596         </tr>
597         <tr>
598           <td class="paramkey"></td>
599           <td></td>
600           <td class="paramtype">uint&#160;</td>
601           <td class="paramname"><em>input_offset_first_element_in_bytes</em>, </td>
602         </tr>
603         <tr>
604           <td class="paramkey"></td>
605           <td></td>
606           <td class="paramtype">__global uchar *&#160;</td>
607           <td class="paramname"><em>output_ptr</em>, </td>
608         </tr>
609         <tr>
610           <td class="paramkey"></td>
611           <td></td>
612           <td class="paramtype">uint&#160;</td>
613           <td class="paramname"><em>output_stride_x</em>, </td>
614         </tr>
615         <tr>
616           <td class="paramkey"></td>
617           <td></td>
618           <td class="paramtype">uint&#160;</td>
619           <td class="paramname"><em>output_step_x</em>, </td>
620         </tr>
621         <tr>
622           <td class="paramkey"></td>
623           <td></td>
624           <td class="paramtype">uint&#160;</td>
625           <td class="paramname"><em>output_stride_y</em>, </td>
626         </tr>
627         <tr>
628           <td class="paramkey"></td>
629           <td></td>
630           <td class="paramtype">uint&#160;</td>
631           <td class="paramname"><em>output_step_y</em>, </td>
632         </tr>
633         <tr>
634           <td class="paramkey"></td>
635           <td></td>
636           <td class="paramtype">uint&#160;</td>
637           <td class="paramname"><em>output_stride_z</em>, </td>
638         </tr>
639         <tr>
640           <td class="paramkey"></td>
641           <td></td>
642           <td class="paramtype">uint&#160;</td>
643           <td class="paramname"><em>output_step_z</em>, </td>
644         </tr>
645         <tr>
646           <td class="paramkey"></td>
647           <td></td>
648           <td class="paramtype">uint&#160;</td>
649           <td class="paramname"><em>output_offset_first_element_in_bytes</em>&#160;</td>
650         </tr>
651         <tr>
652           <td></td>
653           <td>)</td>
654           <td></td><td></td>
655         </tr>
656       </table>
657 </div><div class="memdoc">
658
659 <p>Performs a pooling function of pool size equal to 2. </p>
660 <dl class="section note"><dt>Note</dt><dd>Datatype must be passed using -DDATA_TYPE e.g. -DDATA_TYPE=float. Supported data types are QS8/QS16/F16/F32; </dd>
661 <dd>
662 In case of average pooling the following information must be passed at compile time: -DPOOL_AVG or -DPOOL_L2 must be provided otherwise max pooling will be performed. -DMAX_WIDTH and -DMAX_HEIGHT which are the maximum accessible indeces in x and y dimensions (width + pad) -DSTRIDE_X and -DSTRIDE_Y which are the steps of the window along the x and y directions -DPAD_X and -DPAD_Y which are the pooling paddings in x and y dimension</dd></dl>
663 <dl class="params"><dt>Parameters</dt><dd>
664   <table class="params">
665     <tr><td class="paramdir">[in]</td><td class="paramname">input_ptr</td><td>Pointer to the source image. Supported data types: QS8/QS16/F16/F32 </td></tr>
666     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
667     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_x</td><td>input_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
668     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
669     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_y</td><td>input_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
670     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
671     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_z</td><td>input_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
672     <tr><td class="paramdir">[in]</td><td class="paramname">input_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
673     <tr><td class="paramdir">[out]</td><td class="paramname">output_ptr</td><td>Pointer to the destination image. Supported data types: same as <code>input_ptr</code> </td></tr>
674     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_x</td><td>Stride of the destination image in X dimension (in bytes) </td></tr>
675     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_x</td><td>output_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
676     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_y</td><td>Stride of the destination image in Y dimension (in bytes) </td></tr>
677     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_y</td><td>output_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
678     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
679     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_z</td><td>output_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
680     <tr><td class="paramdir">[in]</td><td class="paramname">output_offset_first_element_in_bytes</td><td>The offset of the first element in the destination image </td></tr>
681   </table>
682   </dd>
683 </dl>
684
685 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00228">228</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
686
687 <p>References <a class="el" href="pooling__layer_8cl_source.xhtml#l00188">calculate_avg_scale()</a>, <a class="el" href="helpers_8h_source.xhtml#l00119">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00060">DIV_OP</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00049">POOL_OP</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00057">POW2_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00153">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00315">tensor3D_offset()</a>, and <a class="el" href="fixed__point_8h_source.xhtml#l00093">VEC_DATA_TYPE</a>.</p>
688 <div class="fragment"><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;{</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;    <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;    <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> input  = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(input);</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> output = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(output);</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    <span class="comment">// Load data</span></div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;    data0 = vload2(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0));</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;    <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    data1 = vload2(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0));</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    <span class="comment">// Raise to power of 2 for L2 Pooling</span></div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;    data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 2);</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 2);</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    <span class="comment">// Perform calculations</span></div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    data0         = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    DATA_TYPE res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0.s0, data0.s1);</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <span class="comment">// Divide by pool region in case of average or l2 pooling</span></div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    res = <a class="code" href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a>(res, <a class="code" href="pooling__layer_8cl.xhtml#ac8f27d6ce33043a58fc6bd17b41f8153">calculate_avg_scale</a>(2, 2, MAX_WIDTH, MAX_HEIGHT, PAD_X, PAD_Y, STRIDE_X, STRIDE_Y));</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    <span class="comment">// Take square root of the result in L2 pooling</span></div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;    <span class="comment">// Store result</span></div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;    *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;}</div><div class="ttc" id="pooling__layer_8cl_xhtml_a5db17889d824975fefb2ce2f4690637f"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a></div><div class="ttdeci">#define DIV_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00060">pooling_layer.cl:60</a></div></div>
689 <div class="ttc" id="pooling__layer_8cl_xhtml_a482ef7d59a5f474ca126e737c7f0978a"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a></div><div class="ttdeci">#define POOL_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00049">pooling_layer.cl:49</a></div></div>
690 <div class="ttc" id="helpers_8h_xhtml_a31c8c760f08fb1a331b16b7c204321dc"><div class="ttname"><a href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_TENSOR3D_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00119">helpers.h:119</a></div></div>
691 <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>
692 <div class="ttc" id="struct_tensor3_d_xhtml"><div class="ttname"><a href="struct_tensor3_d.xhtml">Tensor3D</a></div><div class="ttdoc">Structure to hold 3D tensor information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00151">helpers.h:151</a></div></div>
693 <div class="ttc" id="pooling__layer_8cl_xhtml_a03898439d164d74f8c35bafb67262d95"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a></div><div class="ttdeci">#define POW2_OP(x, vec_size)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00057">pooling_layer.cl:57</a></div></div>
694 <div class="ttc" id="pooling__layer_8cl_xhtml_ac8f27d6ce33043a58fc6bd17b41f8153"><div class="ttname"><a href="pooling__layer_8cl.xhtml#ac8f27d6ce33043a58fc6bd17b41f8153">calculate_avg_scale</a></div><div class="ttdeci">DATA_TYPE calculate_avg_scale(const int pool_size_x, const int pool_size_y, const int upper_bound_w, const int upper_bound_h, const int pad_x, const int pad_y, const int stride_x, const int stride_y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00188">pooling_layer.cl:188</a></div></div>
695 <div class="ttc" id="helpers_8h_xhtml_a2101b2fe0193ce227ae4e0945e321d85"><div class="ttname"><a href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a></div><div class="ttdeci">__global const uchar * tensor3D_offset(const Tensor3D *tensor, int x, int y, int z)</div><div class="ttdoc">Get the pointer position of a Tensor3D. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00315">helpers.h:315</a></div></div>
696 <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>
697 <div class="ttc" id="struct_tensor3_d_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">Tensor3D::ptr</a></div><div class="ttdeci">__global uchar * ptr</div><div class="ttdoc">Pointer to the starting postion of the buffer. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00153">helpers.h:153</a></div></div>
698 <div class="ttc" id="pooling__layer_8cl_xhtml_ac9af19bec38fe50b4b9585c0e5c0ccca"><div class="ttname"><a href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a></div><div class="ttdeci">#define SQRT_OP(x)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00061">pooling_layer.cl:61</a></div></div>
699 </div><!-- fragment -->
700 </div>
701 </div>
702 <a class="anchor" id="af5751970a4d8c62febdc6c63d6d4fd1d"></a>
703 <div class="memitem">
704 <div class="memproto">
705       <table class="memname">
706         <tr>
707           <td class="memname">__kernel void pooling_layer_3 </td>
708           <td>(</td>
709           <td class="paramtype">__global uchar *&#160;</td>
710           <td class="paramname"><em>input_ptr</em>, </td>
711         </tr>
712         <tr>
713           <td class="paramkey"></td>
714           <td></td>
715           <td class="paramtype">uint&#160;</td>
716           <td class="paramname"><em>input_stride_x</em>, </td>
717         </tr>
718         <tr>
719           <td class="paramkey"></td>
720           <td></td>
721           <td class="paramtype">uint&#160;</td>
722           <td class="paramname"><em>input_step_x</em>, </td>
723         </tr>
724         <tr>
725           <td class="paramkey"></td>
726           <td></td>
727           <td class="paramtype">uint&#160;</td>
728           <td class="paramname"><em>input_stride_y</em>, </td>
729         </tr>
730         <tr>
731           <td class="paramkey"></td>
732           <td></td>
733           <td class="paramtype">uint&#160;</td>
734           <td class="paramname"><em>input_step_y</em>, </td>
735         </tr>
736         <tr>
737           <td class="paramkey"></td>
738           <td></td>
739           <td class="paramtype">uint&#160;</td>
740           <td class="paramname"><em>input_stride_z</em>, </td>
741         </tr>
742         <tr>
743           <td class="paramkey"></td>
744           <td></td>
745           <td class="paramtype">uint&#160;</td>
746           <td class="paramname"><em>input_step_z</em>, </td>
747         </tr>
748         <tr>
749           <td class="paramkey"></td>
750           <td></td>
751           <td class="paramtype">uint&#160;</td>
752           <td class="paramname"><em>input_offset_first_element_in_bytes</em>, </td>
753         </tr>
754         <tr>
755           <td class="paramkey"></td>
756           <td></td>
757           <td class="paramtype">__global uchar *&#160;</td>
758           <td class="paramname"><em>output_ptr</em>, </td>
759         </tr>
760         <tr>
761           <td class="paramkey"></td>
762           <td></td>
763           <td class="paramtype">uint&#160;</td>
764           <td class="paramname"><em>output_stride_x</em>, </td>
765         </tr>
766         <tr>
767           <td class="paramkey"></td>
768           <td></td>
769           <td class="paramtype">uint&#160;</td>
770           <td class="paramname"><em>output_step_x</em>, </td>
771         </tr>
772         <tr>
773           <td class="paramkey"></td>
774           <td></td>
775           <td class="paramtype">uint&#160;</td>
776           <td class="paramname"><em>output_stride_y</em>, </td>
777         </tr>
778         <tr>
779           <td class="paramkey"></td>
780           <td></td>
781           <td class="paramtype">uint&#160;</td>
782           <td class="paramname"><em>output_step_y</em>, </td>
783         </tr>
784         <tr>
785           <td class="paramkey"></td>
786           <td></td>
787           <td class="paramtype">uint&#160;</td>
788           <td class="paramname"><em>output_stride_z</em>, </td>
789         </tr>
790         <tr>
791           <td class="paramkey"></td>
792           <td></td>
793           <td class="paramtype">uint&#160;</td>
794           <td class="paramname"><em>output_step_z</em>, </td>
795         </tr>
796         <tr>
797           <td class="paramkey"></td>
798           <td></td>
799           <td class="paramtype">uint&#160;</td>
800           <td class="paramname"><em>output_offset_first_element_in_bytes</em>&#160;</td>
801         </tr>
802         <tr>
803           <td></td>
804           <td>)</td>
805           <td></td><td></td>
806         </tr>
807       </table>
808 </div><div class="memdoc">
809
810 <p>Performs a pooling function of pool size equal to 3. </p>
811 <dl class="section note"><dt>Note</dt><dd>Datatype must be passed using -DDATA_TYPE e.g. -DDATA_TYPE=float. Supported data types are QS8/QS16/F16/F32; </dd>
812 <dd>
813 In case of average pooling the following information must be passed at compile time: -DPOOL_AVG or -DPOOL_L2 must be provided otherwise max pooling will be performed. -DMAX_WIDTH and -DMAX_HEIGHT which are the maximum accessible indeces in x and y dimensions (width + pad) -DSTRIDE_X and -DSTRIDE_Y which are the steps of the window along the x and y directions -DPAD_X and -DPAD_Y which are the pooling paddings in x and y dimension</dd></dl>
814 <dl class="params"><dt>Parameters</dt><dd>
815   <table class="params">
816     <tr><td class="paramdir">[in]</td><td class="paramname">input_ptr</td><td>Pointer to the source image. Supported data types: QS8/QS16/F16/F32 </td></tr>
817     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
818     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_x</td><td>input_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
819     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
820     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_y</td><td>input_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
821     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
822     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_z</td><td>input_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
823     <tr><td class="paramdir">[in]</td><td class="paramname">input_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
824     <tr><td class="paramdir">[out]</td><td class="paramname">output_ptr</td><td>Pointer to the destination image. Supported data types: same as <code>input_ptr</code> </td></tr>
825     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_x</td><td>Stride of the destination image in X dimension (in bytes) </td></tr>
826     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_x</td><td>output_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
827     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_y</td><td>Stride of the destination image in Y dimension (in bytes) </td></tr>
828     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_y</td><td>output_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
829     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
830     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_z</td><td>output_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
831     <tr><td class="paramdir">[in]</td><td class="paramname">output_offset_first_element_in_bytes</td><td>The offset of the first element in the destination image </td></tr>
832   </table>
833   </dd>
834 </dl>
835
836 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00292">292</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
837
838 <p>References <a class="el" href="pooling__layer_8cl_source.xhtml#l00188">calculate_avg_scale()</a>, <a class="el" href="helpers_8h_source.xhtml#l00119">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00060">DIV_OP</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00049">POOL_OP</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00057">POW2_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00153">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00315">tensor3D_offset()</a>, and <a class="el" href="fixed__point_8h_source.xhtml#l00093">VEC_DATA_TYPE</a>.</p>
839 <div class="fragment"><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;{</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;    <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;    <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> input  = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(input);</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;    <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> output = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(output);</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;    <span class="comment">// Load data</span></div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;    <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    data0 = vload3(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0));</div><div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;    <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    data1 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0));</div><div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 3)</div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;    data2 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0));</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    <span class="comment">// Raise to power of 2 for L2 Pooling</span></div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 3);</div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;    data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 3);</div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    data2 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data2, 3);</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;    <span class="comment">// Perform calculations</span></div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    data0         = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;    data0         = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data2);</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    DATA_TYPE res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(<a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0.s0, data0.s1), data0.s2);</div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;    <span class="comment">// Divide by pool region in case of average pooling</span></div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    res = <a class="code" href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a>(res, <a class="code" href="pooling__layer_8cl.xhtml#ac8f27d6ce33043a58fc6bd17b41f8153">calculate_avg_scale</a>(3, 3, MAX_WIDTH, MAX_HEIGHT, PAD_X, PAD_Y, STRIDE_X, STRIDE_Y));</div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    <span class="comment">// Take square root of the result in L2 pooling</span></div><div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;    <span class="comment">// Store result</span></div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;}</div><div class="ttc" id="pooling__layer_8cl_xhtml_a5db17889d824975fefb2ce2f4690637f"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a></div><div class="ttdeci">#define DIV_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00060">pooling_layer.cl:60</a></div></div>
840 <div class="ttc" id="pooling__layer_8cl_xhtml_a482ef7d59a5f474ca126e737c7f0978a"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a></div><div class="ttdeci">#define POOL_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00049">pooling_layer.cl:49</a></div></div>
841 <div class="ttc" id="helpers_8h_xhtml_a31c8c760f08fb1a331b16b7c204321dc"><div class="ttname"><a href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_TENSOR3D_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00119">helpers.h:119</a></div></div>
842 <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>
843 <div class="ttc" id="struct_tensor3_d_xhtml"><div class="ttname"><a href="struct_tensor3_d.xhtml">Tensor3D</a></div><div class="ttdoc">Structure to hold 3D tensor information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00151">helpers.h:151</a></div></div>
844 <div class="ttc" id="pooling__layer_8cl_xhtml_a03898439d164d74f8c35bafb67262d95"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a></div><div class="ttdeci">#define POW2_OP(x, vec_size)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00057">pooling_layer.cl:57</a></div></div>
845 <div class="ttc" id="pooling__layer_8cl_xhtml_ac8f27d6ce33043a58fc6bd17b41f8153"><div class="ttname"><a href="pooling__layer_8cl.xhtml#ac8f27d6ce33043a58fc6bd17b41f8153">calculate_avg_scale</a></div><div class="ttdeci">DATA_TYPE calculate_avg_scale(const int pool_size_x, const int pool_size_y, const int upper_bound_w, const int upper_bound_h, const int pad_x, const int pad_y, const int stride_x, const int stride_y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00188">pooling_layer.cl:188</a></div></div>
846 <div class="ttc" id="helpers_8h_xhtml_a2101b2fe0193ce227ae4e0945e321d85"><div class="ttname"><a href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a></div><div class="ttdeci">__global const uchar * tensor3D_offset(const Tensor3D *tensor, int x, int y, int z)</div><div class="ttdoc">Get the pointer position of a Tensor3D. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00315">helpers.h:315</a></div></div>
847 <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>
848 <div class="ttc" id="struct_tensor3_d_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">Tensor3D::ptr</a></div><div class="ttdeci">__global uchar * ptr</div><div class="ttdoc">Pointer to the starting postion of the buffer. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00153">helpers.h:153</a></div></div>
849 <div class="ttc" id="pooling__layer_8cl_xhtml_ac9af19bec38fe50b4b9585c0e5c0ccca"><div class="ttname"><a href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a></div><div class="ttdeci">#define SQRT_OP(x)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00061">pooling_layer.cl:61</a></div></div>
850 </div><!-- fragment -->
851 </div>
852 </div>
853 <a class="anchor" id="ac320fea94a0f786ca35fe159d57a6e49"></a>
854 <div class="memitem">
855 <div class="memproto">
856       <table class="memname">
857         <tr>
858           <td class="memname">__kernel void pooling_layer_MxN_nhwc </td>
859           <td>(</td>
860           <td class="paramtype">__global uchar *&#160;</td>
861           <td class="paramname"><em>input_ptr</em>, </td>
862         </tr>
863         <tr>
864           <td class="paramkey"></td>
865           <td></td>
866           <td class="paramtype">uint&#160;</td>
867           <td class="paramname"><em>input_stride_x</em>, </td>
868         </tr>
869         <tr>
870           <td class="paramkey"></td>
871           <td></td>
872           <td class="paramtype">uint&#160;</td>
873           <td class="paramname"><em>input_step_x</em>, </td>
874         </tr>
875         <tr>
876           <td class="paramkey"></td>
877           <td></td>
878           <td class="paramtype">uint&#160;</td>
879           <td class="paramname"><em>input_stride_y</em>, </td>
880         </tr>
881         <tr>
882           <td class="paramkey"></td>
883           <td></td>
884           <td class="paramtype">uint&#160;</td>
885           <td class="paramname"><em>input_step_y</em>, </td>
886         </tr>
887         <tr>
888           <td class="paramkey"></td>
889           <td></td>
890           <td class="paramtype">uint&#160;</td>
891           <td class="paramname"><em>input_stride_z</em>, </td>
892         </tr>
893         <tr>
894           <td class="paramkey"></td>
895           <td></td>
896           <td class="paramtype">uint&#160;</td>
897           <td class="paramname"><em>input_step_z</em>, </td>
898         </tr>
899         <tr>
900           <td class="paramkey"></td>
901           <td></td>
902           <td class="paramtype">uint&#160;</td>
903           <td class="paramname"><em>input_offset_first_element_in_bytes</em>, </td>
904         </tr>
905         <tr>
906           <td class="paramkey"></td>
907           <td></td>
908           <td class="paramtype">__global uchar *&#160;</td>
909           <td class="paramname"><em>output_ptr</em>, </td>
910         </tr>
911         <tr>
912           <td class="paramkey"></td>
913           <td></td>
914           <td class="paramtype">uint&#160;</td>
915           <td class="paramname"><em>output_stride_x</em>, </td>
916         </tr>
917         <tr>
918           <td class="paramkey"></td>
919           <td></td>
920           <td class="paramtype">uint&#160;</td>
921           <td class="paramname"><em>output_step_x</em>, </td>
922         </tr>
923         <tr>
924           <td class="paramkey"></td>
925           <td></td>
926           <td class="paramtype">uint&#160;</td>
927           <td class="paramname"><em>output_stride_y</em>, </td>
928         </tr>
929         <tr>
930           <td class="paramkey"></td>
931           <td></td>
932           <td class="paramtype">uint&#160;</td>
933           <td class="paramname"><em>output_step_y</em>, </td>
934         </tr>
935         <tr>
936           <td class="paramkey"></td>
937           <td></td>
938           <td class="paramtype">uint&#160;</td>
939           <td class="paramname"><em>output_stride_z</em>, </td>
940         </tr>
941         <tr>
942           <td class="paramkey"></td>
943           <td></td>
944           <td class="paramtype">uint&#160;</td>
945           <td class="paramname"><em>output_step_z</em>, </td>
946         </tr>
947         <tr>
948           <td class="paramkey"></td>
949           <td></td>
950           <td class="paramtype">uint&#160;</td>
951           <td class="paramname"><em>output_offset_first_element_in_bytes</em>&#160;</td>
952         </tr>
953         <tr>
954           <td></td>
955           <td>)</td>
956           <td></td><td></td>
957         </tr>
958       </table>
959 </div><div class="memdoc">
960
961 <p>Performs a pooling function of pool size equal to N (NHWC) </p>
962 <dl class="section note"><dt>Note</dt><dd>Datatype must be passed using -DDATA_TYPE e.g. -DDATA_TYPE=float. Supported data types are F16/F32 </dd>
963 <dd>
964 -DFP16 must be passed at compile time if half float data type is used </dd>
965 <dd>
966 Pool sizes must be passed using -DPOOL_SIZE_X and -DPOOL_SIZE_Y e.g. -DPOOL_SIZE_X=13; </dd>
967 <dd>
968 Tensors width and height must be passed at compile time using -DMAX_WIDTH and -DMAX_HEIGHT </dd>
969 <dd>
970 Strides must be passed at compile time using -DSTRIDE_X and -DSTRIDE_Y which are the steps of the window along the x and y directions </dd>
971 <dd>
972 Pad values must be passed at compile time using -DPAD_X and -DPAD_Y which are the pooling paddings in x and y dimension </dd>
973 <dd>
974 In case of average pooling the following information must be passed at compile time: -DPOOL_AVG must be provided otherwise max pooling will be performed.</dd></dl>
975 <dl class="params"><dt>Parameters</dt><dd>
976   <table class="params">
977     <tr><td class="paramdir">[in]</td><td class="paramname">input_ptr</td><td>Pointer to the source image. Supported data types: F16/F32 </td></tr>
978     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
979     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_x</td><td>input_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
980     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
981     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_y</td><td>input_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
982     <tr><td class="paramdir">[in]</td><td class="paramname">input_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
983     <tr><td class="paramdir">[in]</td><td class="paramname">input_step_z</td><td>input_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
984     <tr><td class="paramdir">[in]</td><td class="paramname">input_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
985     <tr><td class="paramdir">[out]</td><td class="paramname">output_ptr</td><td>Pointer to the destination image. Supported data types: same as <code>input_ptr</code> </td></tr>
986     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_x</td><td>Stride of the destination image in X dimension (in bytes) </td></tr>
987     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_x</td><td>output_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
988     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_y</td><td>Stride of the destination image in Y dimension (in bytes) </td></tr>
989     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_y</td><td>output_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
990     <tr><td class="paramdir">[in]</td><td class="paramname">output_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
991     <tr><td class="paramdir">[in]</td><td class="paramname">output_step_z</td><td>output_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
992     <tr><td class="paramdir">[in]</td><td class="paramname">output_offset_first_element_in_bytes</td><td>The offset of the first element in the destination image </td></tr>
993   </table>
994   </dd>
995 </dl>
996
997 <p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">565</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
998
999 <p>References <a class="el" href="pooling__layer_8cl_source.xhtml#l00518">calculate_avg_scale_nhwc()</a>, <a class="el" href="helpers_8h_source.xhtml#l00119">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00065">DIV_OP_NHWC</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00049">POOL_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00153">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00315">tensor3D_offset()</a>, and <a class="el" href="fixed__point_8h_source.xhtml#l00093">VEC_DATA_TYPE</a>.</p>
1000 <div class="fragment"><div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;{</div><div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;    <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;    <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> input  = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(input);</div><div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;    <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> output = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(output);</div><div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;</div><div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;    <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)</div><div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;    vdata           = INITIAL_VALUE;</div><div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;    <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> sdata = INITIAL_VALUE;</div><div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;</div><div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;    const <span class="keywordtype">int</span> idx_width  = get_global_id(1) * STRIDE_X;</div><div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;    const <span class="keywordtype">int</span> idx_height = get_global_id(2) * STRIDE_Y;</div><div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;</div><div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;    for(<span class="keywordtype">int</span> y = 0; y &lt; POOL_SIZE_Y; ++y)</div><div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;    {</div><div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;        <span class="keywordtype">int</span> y1 = select(y, PAD_Y - idx_height, y + idx_height &lt; PAD_Y || y + idx_height &gt; MAX_HEIGHT);</div><div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x = 0; x &lt; POOL_SIZE_X; ++x)</div><div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;        {</div><div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;            <span class="keywordtype">int</span> x1 = select(x, PAD_X - idx_width - 1, x + idx_width &lt; PAD_X || x + idx_width &gt; MAX_WIDTH);</div><div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;            x1     = select(x1, PAD_X - idx_width - 1, y != y1);</div><div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;</div><div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;            <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)</div><div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;            data0 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, x1 - PAD_X, y1 - PAD_Y));</div><div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;            <span class="comment">// Raise to power of 2 for L2 Pooling</span></div><div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;            data0 *= data0;</div><div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;            vdata = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(vdata, data0);</div><div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;        }</div><div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    }</div><div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;</div><div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;    <span class="comment">// Divide by pool region in case of average pooling</span></div><div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;    vdata = <a class="code" href="pooling__layer_8cl.xhtml#a6c01fa98d360a9d52926dc6a5a599711">DIV_OP_NHWC</a>(vdata, <a class="code" href="pooling__layer_8cl.xhtml#a93173b51e52924504320e874affcf881">calculate_avg_scale_nhwc</a>(POOL_SIZE_X, POOL_SIZE_Y, MAX_WIDTH, MAX_HEIGHT, PAD_X, PAD_Y, STRIDE_X, STRIDE_Y));</div><div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;</div><div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;    <span class="comment">// Take square root of the result in L2 pooling</span></div><div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;    vdata = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(vdata);</div><div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;</div><div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;    <span class="comment">// Store result</span></div><div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;    vstore8(vdata, 0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;}</div><div class="ttc" id="pooling__layer_8cl_xhtml_a93173b51e52924504320e874affcf881"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a93173b51e52924504320e874affcf881">calculate_avg_scale_nhwc</a></div><div class="ttdeci">DATA_TYPE calculate_avg_scale_nhwc(const int pool_size_x, const int pool_size_y, int upper_bound_w, int upper_bound_h, const int pad_x, const int pad_y, const int stride_x, const int stride_y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00518">pooling_layer.cl:518</a></div></div>
1001 <div class="ttc" id="pooling__layer_8cl_xhtml_a482ef7d59a5f474ca126e737c7f0978a"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a></div><div class="ttdeci">#define POOL_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00049">pooling_layer.cl:49</a></div></div>
1002 <div class="ttc" id="helpers_8h_xhtml_a31c8c760f08fb1a331b16b7c204321dc"><div class="ttname"><a href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_TENSOR3D_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00119">helpers.h:119</a></div></div>
1003 <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>
1004 <div class="ttc" id="struct_tensor3_d_xhtml"><div class="ttname"><a href="struct_tensor3_d.xhtml">Tensor3D</a></div><div class="ttdoc">Structure to hold 3D tensor information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00151">helpers.h:151</a></div></div>
1005 <div class="ttc" id="helpers_8h_xhtml_a2101b2fe0193ce227ae4e0945e321d85"><div class="ttname"><a href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a></div><div class="ttdeci">__global const uchar * tensor3D_offset(const Tensor3D *tensor, int x, int y, int z)</div><div class="ttdoc">Get the pointer position of a Tensor3D. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00315">helpers.h:315</a></div></div>
1006 <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>
1007 <div class="ttc" id="pooling__layer_8cl_xhtml_a6c01fa98d360a9d52926dc6a5a599711"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a6c01fa98d360a9d52926dc6a5a599711">DIV_OP_NHWC</a></div><div class="ttdeci">#define DIV_OP_NHWC(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00065">pooling_layer.cl:65</a></div></div>
1008 <div class="ttc" id="struct_tensor3_d_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">Tensor3D::ptr</a></div><div class="ttdeci">__global uchar * ptr</div><div class="ttdoc">Pointer to the starting postion of the buffer. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00153">helpers.h:153</a></div></div>
1009 <div class="ttc" id="pooling__layer_8cl_xhtml_ac9af19bec38fe50b4b9585c0e5c0ccca"><div class="ttname"><a href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a></div><div class="ttdeci">#define SQRT_OP(x)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00061">pooling_layer.cl:61</a></div></div>
1010 </div><!-- fragment -->
1011 </div>
1012 </div>
1013 </div><!-- contents -->
1014 </div><!-- doc-content -->
1015 <!-- start footer part -->
1016 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
1017   <ul>
1018     <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="pooling__layer_8cl.xhtml">pooling_layer.cl</a></li>
1019     <li class="footer">Generated on Wed May 23 2018 11:36:39 for Compute Library by
1020     <a href="http://www.doxygen.org/index.html">
1021     <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
1022   </ul>
1023 </div>
1024 </body>
1025 </html>