<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Compute Library
-  <span id="projectnumber">17.12</span>
+  <span id="projectnumber">18.05</span>
</div>
</td>
</tr>
<tr class="separator:a5db17889d824975fefb2ce2f4690637f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac9af19bec38fe50b4b9585c0e5c0ccca"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(x)   sqrt((x))</td></tr>
<tr class="separator:ac9af19bec38fe50b4b9585c0e5c0ccca"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a6c01fa98d360a9d52926dc6a5a599711"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a6c01fa98d360a9d52926dc6a5a599711">DIV_OP_NHWC</a>(x, y)   (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>
+<tr class="separator:a6c01fa98d360a9d52926dc6a5a599711"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6b8e66069b8cd3e743141d7f024a7d76"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a6b8e66069b8cd3e743141d7f024a7d76">POOLING3x3_STRIDE1</a>(res, input, output)</td></tr>
<tr class="separator:a6b8e66069b8cd3e743141d7f024a7d76"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abb8f7128361a6a1965b1b2a5b3a719b2"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#abb8f7128361a6a1965b1b2a5b3a719b2">POOLING3x3_STRIDE2</a>(res, input, output)</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
-<tr class="memitem:a89667fe8f529db8f7abc465f6476414b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a89667fe8f529db8f7abc465f6476414b">calculate_avg_scale</a> (const int pool_size, 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>
-<tr class="separator:a89667fe8f529db8f7abc465f6476414b"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ac8f27d6ce33043a58fc6bd17b41f8153"><td class="memItemLeft" align="right" valign="top"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> </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>
+<tr class="separator:ac8f27d6ce33043a58fc6bd17b41f8153"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2d95de36199fd06803ffb62f5ff1df08"><td class="memItemLeft" align="right" valign="top">__kernel void </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>
<tr class="memdesc:a2d95de36199fd06803ffb62f5ff1df08"><td class="mdescLeft"> </td><td class="mdescRight">Performs a pooling function of pool size equal to 2. <a href="#a2d95de36199fd06803ffb62f5ff1df08">More...</a><br /></td></tr>
<tr class="separator:a2d95de36199fd06803ffb62f5ff1df08"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="memItemLeft" align="right" valign="top">__kernel void </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>
<tr class="memdesc:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="mdescLeft"> </td><td class="mdescRight">Performs a pooling function of pool size equal to 3. <a href="#af5751970a4d8c62febdc6c63d6d4fd1d">More...</a><br /></td></tr>
<tr class="separator:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:a93173b51e52924504320e874affcf881"><td class="memItemLeft" align="right" valign="top"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> </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>
+<tr class="separator:a93173b51e52924504320e874affcf881"><td class="memSeparator" colspan="2"> </td></tr>
+<tr class="memitem:ac320fea94a0f786ca35fe159d57a6e49"><td class="memItemLeft" align="right" valign="top">__kernel void </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>
+<tr class="memdesc:ac320fea94a0f786ca35fe159d57a6e49"><td class="mdescLeft"> </td><td class="mdescRight">Performs a pooling function of pool size equal to N (NHWC) <a href="#ac320fea94a0f786ca35fe159d57a6e49">More...</a><br /></td></tr>
+<tr class="separator:ac320fea94a0f786ca35fe159d57a6e49"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="a5db17889d824975fefb2ce2f4690637f"></a>
<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>
-<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00226">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00290">pooling_layer_3()</a>.</p>
+<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>
+
+</div>
+</div>
+<a class="anchor" id="a6c01fa98d360a9d52926dc6a5a599711"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define DIV_OP_NHWC</td>
+ <td>(</td>
+ <td class="paramtype"> </td>
+ <td class="paramname">x, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"> </td>
+ <td class="paramname">y </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td>   (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>
+ </table>
+</div><div class="memdoc">
+
+<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>
+
+<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">pooling_layer_MxN_nhwc()</a>.</p>
</div>
</div>
<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>
-<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00226">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00290">pooling_layer_3()</a>.</p>
+<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>
</div>
</div>
</table>
</div><div class="memdoc">
-<p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00073">73</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
+<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>
</div>
</div>
</table>
</div><div class="memdoc">
-<p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00116">116</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
+<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>
</div>
</div>
<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>(&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>(&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>(&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>(&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>(&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>(&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>
<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>
<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>
-<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#l00313">helpers.h:313</a></div></div>
+<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>
<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>
</div><!-- fragment -->
-<p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00156">156</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
+<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>
</div>
</div>
<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>
-<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00226">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00290">pooling_layer_3()</a>.</p>
+<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>
</div>
</div>
<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>
-<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00226">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00290">pooling_layer_3()</a>.</p>
+<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>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
-<a class="anchor" id="a89667fe8f529db8f7abc465f6476414b"></a>
+<a class="anchor" id="ac8f27d6ce33043a58fc6bd17b41f8153"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<td class="memname"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> calculate_avg_scale </td>
<td>(</td>
<td class="paramtype">const int </td>
- <td class="paramname"><em>pool_size</em>, </td>
+ <td class="paramname"><em>pool_size_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>pool_size_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
</table>
</div><div class="memdoc">
-<p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00186">186</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
+<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>
-<p>References <a class="el" href="tests_2validation_2_fixed_point_8h_source.xhtml#l00889">arm_compute::test::fixed_point_arithmetic::detail::max()</a>, and <a class="el" href="tests_2validation_2_fixed_point_8h_source.xhtml#l00884">arm_compute::test::fixed_point_arithmetic::detail::min()</a>.</p>
+<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>
-<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00226">pooling_layer_2()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00290">pooling_layer_3()</a>.</p>
-<div class="fragment"><div class="line"><a name="l00188"></a><span class="lineno"> 188</span> {</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordtype">int</span> start_x = get_global_id(0) * stride_x - pad_x;</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <span class="keywordtype">int</span> start_y = get_global_id(1) * stride_y - pad_y;</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <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, upper_bound_w);</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <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, upper_bound_h);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> <span class="preprocessor">#if defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  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="l00195"></a><span class="lineno"> 195</span>  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="l00196"></a><span class="lineno"> 196</span> <span class="preprocessor">#endif </span><span class="comment">/* defined(EXCLUDE_PADDING) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> ((end_y - start_y) * (end_x - start_x));</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div><div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_aabcf39e3917f842dbc5fbb0d802f24d5"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">arm_compute::test::fixed_point_arithmetic::detail::min</a></div><div class="ttdeci">fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00884">FixedPoint.h:884</a></div></div>
-<div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_ad91bb73431b4de1f4946ed949d444849"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">arm_compute::test::fixed_point_arithmetic::detail::max</a></div><div class="ttdeci">fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00889">FixedPoint.h:889</a></div></div>
+<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>
+<div class="fragment"><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> {</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <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>  <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>  <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>  <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> <span class="preprocessor">#if defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  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>  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> <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>  <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> }</div><div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_aabcf39e3917f842dbc5fbb0d802f24d5"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">arm_compute::test::fixed_point_arithmetic::detail::min</a></div><div class="ttdeci">fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00897">FixedPoint.h:897</a></div></div>
+<div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_ad91bb73431b4de1f4946ed949d444849"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">arm_compute::test::fixed_point_arithmetic::detail::max</a></div><div class="ttdeci">fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00902">FixedPoint.h:902</a></div></div>
+</div><!-- fragment -->
+</div>
+</div>
+<a class="anchor" id="a93173b51e52924504320e874affcf881"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="convolution9x9_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> calculate_avg_scale_nhwc </td>
+ <td>(</td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>pool_size_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>pool_size_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>upper_bound_w</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>upper_bound_h</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>pad_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>pad_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>stride_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">const int </td>
+ <td class="paramname"><em>stride_y</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<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>
+
+<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>
+
+<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00565">pooling_layer_MxN_nhwc()</a>.</p>
+<div class="fragment"><div class="line"><a name="l00520"></a><span class="lineno"> 520</span> {</div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <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>  <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> </div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span> <span class="preprocessor">#if !defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00525"></a><span class="lineno"> 525</span>  upper_bound_w += pad_x;</div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span>  upper_bound_h += pad_y;</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span> <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>  <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>  <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> <span class="preprocessor">#if defined(EXCLUDE_PADDING)</span></div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span>  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>  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> <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>  <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> }</div><div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_aabcf39e3917f842dbc5fbb0d802f24d5"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">arm_compute::test::fixed_point_arithmetic::detail::min</a></div><div class="ttdeci">fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00897">FixedPoint.h:897</a></div></div>
+<div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_ad91bb73431b4de1f4946ed949d444849"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#ad91bb73431b4de1f4946ed949d444849">arm_compute::test::fixed_point_arithmetic::detail::max</a></div><div class="ttdeci">fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00902">FixedPoint.h:902</a></div></div>
</div><!-- fragment -->
</div>
</div>
</dd>
</dl>
-<p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00226">226</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
+<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>
-<p>References <a class="el" href="pooling__layer_8cl_source.xhtml#l00186">calculate_avg_scale()</a>, <a class="el" href="helpers_8h_source.xhtml#l00117">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#l00151">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00313">tensor3D_offset()</a>, and <a class="el" href="fixed__point_8h_source.xhtml#l00093">VEC_DATA_TYPE</a>.</p>
-<div class="fragment"><div class="line"><a name="l00229"></a><span class="lineno"> 229</span> {</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <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="l00232"></a><span class="lineno"> 232</span>  <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="l00233"></a><span class="lineno"> 233</span> </div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="comment">// Load data</span></div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  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>(&input, 0, 0, 0));</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  data1 = vload2(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&input, 0, 1, 0));</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span> </div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  <span class="comment">// Raise to power of 2 for L2 Pooling</span></div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 2);</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 2);</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span> <span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span> </div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="comment">// Perform calculations</span></div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  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="l00249"></a><span class="lineno"> 249</span> </div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span> <span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="comment">// Divide by pool region in case of average or l2 pooling</span></div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  res = <a class="code" href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a>(res, <a class="code" href="pooling__layer_8cl.xhtml#a89667fe8f529db8f7abc465f6476414b">calculate_avg_scale</a>(2, MAX_WIDTH, MAX_HEIGHT, PAD_X, PAD_Y, STRIDE_X, STRIDE_Y));</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span> <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="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  <span class="comment">// Take square root of the result in L2 pooling</span></div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span> <span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span> </div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="comment">// Store result</span></div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span> }</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>
+<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>
+<div class="fragment"><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <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>  <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> </div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="comment">// Load data</span></div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  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>(&input, 0, 0, 0));</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  data1 = vload2(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&input, 0, 1, 0));</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span> </div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <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>  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>  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> <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> </div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="comment">// Perform calculations</span></div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  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>  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> </div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span> <span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <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>  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> <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> </div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <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>  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> <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> </div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="comment">// Store result</span></div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  *(__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> }</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>
<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>
-<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#l00117">helpers.h:117</a></div></div>
+<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>
<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>
-<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#l00149">helpers.h:149</a></div></div>
+<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>
<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>
-<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#l00313">helpers.h:313</a></div></div>
-<div class="ttc" id="pooling__layer_8cl_xhtml_a89667fe8f529db8f7abc465f6476414b"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a89667fe8f529db8f7abc465f6476414b">calculate_avg_scale</a></div><div class="ttdeci">DATA_TYPE calculate_avg_scale(const int pool_size, 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#l00186">pooling_layer.cl:186</a></div></div>
+<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>
+<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>
<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>
-<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#l00151">helpers.h:151</a></div></div>
+<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>
<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>
</div><!-- fragment -->
</div>
</dd>
</dl>
-<p>Definition at line <a class="el" href="pooling__layer_8cl_source.xhtml#l00290">290</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
+<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>
-<p>References <a class="el" href="pooling__layer_8cl_source.xhtml#l00186">calculate_avg_scale()</a>, <a class="el" href="helpers_8h_source.xhtml#l00117">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#l00151">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00313">tensor3D_offset()</a>, and <a class="el" href="fixed__point_8h_source.xhtml#l00093">VEC_DATA_TYPE</a>.</p>
-<div class="fragment"><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> {</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <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="l00296"></a><span class="lineno"> 296</span>  <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="l00297"></a><span class="lineno"> 297</span> </div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <span class="comment">// Load data</span></div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  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>(&input, 0, 0, 0));</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  data1 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&input, 0, 1, 0));</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 3)</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  data2 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&input, 0, 2, 0));</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> </div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="comment">// Raise to power of 2 for L2 Pooling</span></div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 3);</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 3);</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  data2 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data2, 3);</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> <span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span> </div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  <span class="comment">// Perform calculations</span></div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data2);</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  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="l00317"></a><span class="lineno"> 317</span> </div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span> <span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  <span class="comment">// Divide by pool region in case of average pooling</span></div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  res = <a class="code" href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a>(res, <a class="code" href="pooling__layer_8cl.xhtml#a89667fe8f529db8f7abc465f6476414b">calculate_avg_scale</a>(3, MAX_WIDTH, MAX_HEIGHT, PAD_X, PAD_Y, STRIDE_X, STRIDE_Y));</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> <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="l00322"></a><span class="lineno"> 322</span> </div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <span class="comment">// Take square root of the result in L2 pooling</span></div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span> <span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span> </div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="comment">// Store result</span></div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> }</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>
+<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>
+<div class="fragment"><div class="line"><a name="l00295"></a><span class="lineno"> 295</span> {</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <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>  <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> </div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <span class="comment">// Load data</span></div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  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>(&input, 0, 0, 0));</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  data1 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&input, 0, 1, 0));</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  <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>  data2 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&input, 0, 2, 0));</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span> </div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <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>  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>  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>  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> <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> </div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  <span class="comment">// Perform calculations</span></div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  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>  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>  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> </div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span> <span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  <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>  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> <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> </div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <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>  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> <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> </div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="comment">// Store result</span></div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  *(__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> }</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>
<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>
-<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#l00117">helpers.h:117</a></div></div>
+<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>
<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>
-<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#l00149">helpers.h:149</a></div></div>
+<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>
<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>
-<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#l00313">helpers.h:313</a></div></div>
-<div class="ttc" id="pooling__layer_8cl_xhtml_a89667fe8f529db8f7abc465f6476414b"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a89667fe8f529db8f7abc465f6476414b">calculate_avg_scale</a></div><div class="ttdeci">DATA_TYPE calculate_avg_scale(const int pool_size, 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#l00186">pooling_layer.cl:186</a></div></div>
+<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>
+<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>
+<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>
+<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>
+<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>
+</div><!-- fragment -->
+</div>
+</div>
+<a class="anchor" id="ac320fea94a0f786ca35fe159d57a6e49"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">__kernel void pooling_layer_MxN_nhwc </td>
+ <td>(</td>
+ <td class="paramtype">__global uchar * </td>
+ <td class="paramname"><em>input_ptr</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_stride_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_step_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_stride_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_step_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_stride_z</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_step_z</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>input_offset_first_element_in_bytes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">__global uchar * </td>
+ <td class="paramname"><em>output_ptr</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_stride_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_step_x</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_stride_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_step_y</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_stride_z</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_step_z</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">uint </td>
+ <td class="paramname"><em>output_offset_first_element_in_bytes</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs a pooling function of pool size equal to N (NHWC) </p>
+<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>
+<dd>
+-DFP16 must be passed at compile time if half float data type is used </dd>
+<dd>
+Pool sizes must be passed using -DPOOL_SIZE_X and -DPOOL_SIZE_Y e.g. -DPOOL_SIZE_X=13; </dd>
+<dd>
+Tensors width and height must be passed at compile time using -DMAX_WIDTH and -DMAX_HEIGHT </dd>
+<dd>
+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>
+<dd>
+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>
+<dd>
+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>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </table>
+ </dd>
+</dl>
+
+<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>
+
+<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>
+<div class="fragment"><div class="line"><a name="l00568"></a><span class="lineno"> 568</span> {</div><div class="line"><a name="l00569"></a><span class="lineno"> 569</span>  <span class="comment">// Get pixels pointer</span></div><div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  <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>  <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> </div><div class="line"><a name="l00573"></a><span class="lineno"> 573</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)</div><div class="line"><a name="l00574"></a><span class="lineno"> 574</span>  vdata = INITIAL_VALUE;</div><div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  <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> </div><div class="line"><a name="l00577"></a><span class="lineno"> 577</span>  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>  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> </div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span>  for(<span class="keywordtype">int</span> y = 0; y < POOL_SIZE_Y; ++y)</div><div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  {</div><div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  <span class="keywordtype">int</span> y1 = select(y, PAD_Y - idx_height, y + idx_height < PAD_Y || y + idx_height > MAX_HEIGHT);</div><div class="line"><a name="l00583"></a><span class="lineno"> 583</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x = 0; x < POOL_SIZE_X; ++x)</div><div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  {</div><div class="line"><a name="l00585"></a><span class="lineno"> 585</span>  <span class="keywordtype">int</span> x1 = select(x, PAD_X - idx_width - 1, x + idx_width < PAD_X || x + idx_width > MAX_WIDTH);</div><div class="line"><a name="l00586"></a><span class="lineno"> 586</span>  x1 = select(x1, PAD_X - idx_width - 1, y != y1);</div><div class="line"><a name="l00587"></a><span class="lineno"> 587</span> </div><div class="line"><a name="l00588"></a><span class="lineno"> 588</span>  <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)</div><div class="line"><a name="l00589"></a><span class="lineno"> 589</span>  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>(&input, 0, x1 - PAD_X, y1 - PAD_Y));</div><div class="line"><a name="l00590"></a><span class="lineno"> 590</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <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>  data0 *= data0;</div><div class="line"><a name="l00593"></a><span class="lineno"> 593</span> <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>  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>  }</div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span>  }</div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span> </div><div class="line"><a name="l00598"></a><span class="lineno"> 598</span> <span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div><div class="line"><a name="l00599"></a><span class="lineno"> 599</span>  <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>  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> <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> </div><div class="line"><a name="l00603"></a><span class="lineno"> 603</span> <span class="preprocessor">#if defined(POOL_L2)</span></div><div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  <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>  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> <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> </div><div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  <span class="comment">// Store result</span></div><div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  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> }</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>
+<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>
+<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>
+<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>
+<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>
+<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>
<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>
-<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#l00151">helpers.h:151</a></div></div>
+<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>
+<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>
<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>
</div><!-- fragment -->
</div>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>
- <li class="footer">Generated on Thu Dec 14 2017 23:48:34 for Compute Library by
+ <li class="footer">Generated on Wed May 23 2018 11:36:39 for Compute Library by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>