blob: 28a663f09801c51f780915568dc9b0ca9f942701 [file] [log] [blame]
<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
<title>Compute Library: src/core/CL/cl_kernels/pooling_layer.cl File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Compute Library
&#160;<span id="projectnumber">17.09</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
<li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
<li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
<li class="current"><a href="files.xhtml"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.xhtml"><span>File&#160;List</span></a></li>
<li><a href="globals.xhtml"><span>Globals</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('pooling__layer_8cl.xhtml','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark">&#160;</span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">pooling_layer.cl File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>&quot;</code><br/>
</div>
<p><a href="pooling__layer_8cl_source.xhtml">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a482ef7d59a5f474ca126e737c7f0978a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(x, y)&#160;&#160;&#160;((x) + (y))</td></tr>
<tr class="separator:a482ef7d59a5f474ca126e737c7f0978a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03898439d164d74f8c35bafb67262d95"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(x, vec_size)&#160;&#160;&#160;(x)</td></tr>
<tr class="separator:a03898439d164d74f8c35bafb67262d95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5db17889d824975fefb2ce2f4690637f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a>(x, y)&#160;&#160;&#160;(x * (1.f / y))</td></tr>
<tr class="separator:a5db17889d824975fefb2ce2f4690637f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9af19bec38fe50b4b9585c0e5c0ccca"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(x)&#160;&#160;&#160;sqrt((x))</td></tr>
<tr class="separator:ac9af19bec38fe50b4b9585c0e5c0ccca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b8e66069b8cd3e743141d7f024a7d76"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a6b8e66069b8cd3e743141d7f024a7d76">POOLING3x3_STRIDE1</a>(res, input, output)</td></tr>
<tr class="separator:a6b8e66069b8cd3e743141d7f024a7d76"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb8f7128361a6a1965b1b2a5b3a719b2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#abb8f7128361a6a1965b1b2a5b3a719b2">POOLING3x3_STRIDE2</a>(res, input, output)</td></tr>
<tr class="separator:abb8f7128361a6a1965b1b2a5b3a719b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba30215e4df370ff8935f83046e696ea"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#aba30215e4df370ff8935f83046e696ea">POOLING3x3_STRIDE3</a>(res, input, output)</td></tr>
<tr class="separator:aba30215e4df370ff8935f83046e696ea"><td class="memSeparator" colspan="2">&#160;</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>&#160;</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">&#160;</td></tr>
<tr class="memitem:a2d95de36199fd06803ffb62f5ff1df08"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a2d95de36199fd06803ffb62f5ff1df08">pooling_layer_2</a> (__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_stride_z, uint input_step_z, uint input_offset_first_element_in_bytes, __global uchar *output_ptr, uint output_stride_x, uint output_step_x, uint output_stride_y, uint output_step_y, uint output_stride_z, uint output_step_z, uint output_offset_first_element_in_bytes)</td></tr>
<tr class="memdesc:a2d95de36199fd06803ffb62f5ff1df08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a pooling function of pool size equal to 2. <a href="#a2d95de36199fd06803ffb62f5ff1df08">More...</a><br/></td></tr>
<tr class="separator:a2d95de36199fd06803ffb62f5ff1df08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#af5751970a4d8c62febdc6c63d6d4fd1d">pooling_layer_3</a> (__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_stride_z, uint input_step_z, uint input_offset_first_element_in_bytes, __global uchar *output_ptr, uint output_stride_x, uint output_step_x, uint output_stride_y, uint output_step_y, uint output_stride_z, uint output_step_z, uint output_offset_first_element_in_bytes)</td></tr>
<tr class="memdesc:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a pooling function of pool size equal to 3. <a href="#af5751970a4d8c62febdc6c63d6d4fd1d">More...</a><br/></td></tr>
<tr class="separator:af5751970a4d8c62febdc6c63d6d4fd1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a46f86250bbe9f5a1cf6c060e72109546"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pooling__layer_8cl.xhtml#a46f86250bbe9f5a1cf6c060e72109546">pooling_layer_7</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:a46f86250bbe9f5a1cf6c060e72109546"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a pooling function of pool size equal to 7. <a href="#a46f86250bbe9f5a1cf6c060e72109546">More...</a><br/></td></tr>
<tr class="separator:a46f86250bbe9f5a1cf6c060e72109546"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="a5db17889d824975fefb2ce2f4690637f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DIV_OP</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">x, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">y&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;(x * (1.f / y))</td>
</tr>
</table>
</div><div class="memdoc">
<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#l00222">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00286">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00424">pooling_layer_7()</a>.</p>
</div>
</div>
<a class="anchor" id="a482ef7d59a5f474ca126e737c7f0978a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define POOL_OP</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">x, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">y&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;((x) + (y))</td>
</tr>
</table>
</div><div class="memdoc">
<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#l00222">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00286">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00424">pooling_layer_7()</a>.</p>
</div>
</div>
<a class="anchor" id="a6b8e66069b8cd3e743141d7f024a7d76"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define POOLING3x3_STRIDE1</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">res, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">input, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">output&#160;</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#l00073">73</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
</div>
</div>
<a class="anchor" id="abb8f7128361a6a1965b1b2a5b3a719b2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define POOLING3x3_STRIDE2</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">res, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">input, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">output&#160;</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#l00116">116</a> of file <a class="el" href="pooling__layer_8cl_source.xhtml">pooling_layer.cl</a>.</p>
</div>
</div>
<a class="anchor" id="aba30215e4df370ff8935f83046e696ea"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define POOLING3x3_STRIDE3</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">res, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">input, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">output&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">({ <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div>
<div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8) \</div>
<div class="line"> data00 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0)); <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div>
<div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4) \</div>
<div class="line"> data01 = vload4(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0) + 8); <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div>
<div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8) \</div>
<div class="line"> data10 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0)); <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div>
<div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4) \</div>
<div class="line"> data11 = vload4(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0) + 8); <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div>
<div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8) \</div>
<div class="line"> data20 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0)); <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">\</a></div>
<div class="line"><a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4) \</div>
<div class="line"> data21 = vload4(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0) + 8); \</div>
<div class="line"> data00 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data00, 8); \</div>
<div class="line"> data01 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data01, 4); \</div>
<div class="line"> data10 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data10, 8); \</div>
<div class="line"> data11 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data11, 4); \</div>
<div class="line"> data20 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data20, 8); \</div>
<div class="line"> data21 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data21, 4); \</div>
<div class="line"> \</div>
<div class="line"> data00 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data00, data10); \</div>
<div class="line"> data01 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data01, data11); \</div>
<div class="line"> data00 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data00, data20); \</div>
<div class="line"> data01 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data01, data21); \</div>
<div class="line"> \</div>
<div class="line"> res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>((<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4))(data00.s036, data01.s1), (<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4))(data00.s147, data01.s2)); \</div>
<div class="line"> res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(res, (<a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 4))(data00.s25, data01.s03)); \</div>
<div class="line"> })</div>
<div class="ttc" id="pooling__layer_8cl_xhtml_a482ef7d59a5f474ca126e737c7f0978a"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a></div><div class="ttdeci">#define POOL_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00049">pooling_layer.cl:49</a></div></div>
<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#l00304">helpers.h:304</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>
</div>
</div>
<a class="anchor" id="a03898439d164d74f8c35bafb67262d95"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define POW2_OP</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">x, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">vec_size&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;(x)</td>
</tr>
</table>
</div><div class="memdoc">
<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#l00222">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00286">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00424">pooling_layer_7()</a>.</p>
</div>
</div>
<a class="anchor" id="ac9af19bec38fe50b4b9585c0e5c0ccca"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define SQRT_OP</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">x</td><td>)</td>
<td>&#160;&#160;&#160;sqrt((x))</td>
</tr>
</table>
</div><div class="memdoc">
<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#l00222">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00286">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00424">pooling_layer_7()</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a89667fe8f529db8f7abc465f6476414b"></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 </td>
<td>(</td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>pool_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>upper_bound_w</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>upper_bound_h</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>pad_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>pad_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int&#160;</td>
<td class="paramname"><em>stride_y</em>&#160;</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#l00186">186</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#l00884">arm_compute::test::fixed_point_arithmetic::detail::min()</a>.</p>
<p>Referenced by <a class="el" href="pooling__layer_8cl_source.xhtml#l00222">pooling_layer_2()</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00286">pooling_layer_3()</a>, and <a class="el" href="pooling__layer_8cl_source.xhtml#l00424">pooling_layer_7()</a>.</p>
<div class="fragment"><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;{</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="keyword">const</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>&#160; <span class="keyword">const</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>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> end_x = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">min</a>(start_x + pool_size, upper_bound_w);</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> end_y = <a class="code" href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">min</a>(start_y + pool_size, upper_bound_h);</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; <span class="keywordflow">return</span> ((end_y - start_y) * (end_x - start_x));</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;}</div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail_xhtml_aabcf39e3917f842dbc5fbb0d802f24d5"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1fixed__point__arithmetic_1_1detail.xhtml#aabcf39e3917f842dbc5fbb0d802f24d5">arm_compute::test::fixed_point_arithmetic::detail::min</a></div><div class="ttdeci">fixed_point&lt; T &gt; min(fixed_point&lt; T &gt; x, fixed_point&lt; T &gt; y)</div><div class="ttdef"><b>Definition:</b> <a href="tests_2validation_2_fixed_point_8h_source.xhtml#l00884">FixedPoint.h:884</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a2d95de36199fd06803ffb62f5ff1df08"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void pooling_layer_2 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>input_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</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 *&#160;</td>
<td class="paramname"><em>output_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_offset_first_element_in_bytes</em>&#160;</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 2. </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 QS8/QS16/F16/F32; </dd>
<dd>
In case of average pooling the following information must be passed at compile time: -DPOOL_AVG or -DPOOL_L2 must be provided otherwise max pooling will be performed. -DMAX_WIDTH and -DMAX_HEIGHT which are the maximum accessible indeces in x and y dimensions (width + pad) -DSTRIDE_X and -DSTRIDE_Y which are the steps of the window along the x and y directions -DPAD_X and -DPAD_Y which are the pooling paddings in x and y dimension</dd></dl>
<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: QS8/QS16/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#l00222">222</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#l00108">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#l00142">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00304">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="l00225"></a><span class="lineno"> 225</span>&#160;{</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="comment">// Get pixels pointer</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> input = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(input);</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> output = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(output);</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="comment">// Load data</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; data0 = vload2(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0));</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 2)</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; data1 = vload2(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0));</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;<span class="preprocessor"></span> <span class="comment">// Raise to power of 2 for L2 Pooling</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 2);</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 2);</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="comment">// Perform calculations</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; DATA_TYPE res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0.s0, data0.s1);</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;<span class="preprocessor"></span> <span class="comment">// Divide by pool region in case of average or l2 pooling</span></div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; 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="l00249"></a><span class="lineno"> 249</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;<span class="preprocessor"></span> <span class="comment">// Take square root of the result in L2 pooling</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="comment">// Store result</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;}</div>
<div class="ttc" id="pooling__layer_8cl_xhtml_a5db17889d824975fefb2ce2f4690637f"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a></div><div class="ttdeci">#define DIV_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00060">pooling_layer.cl:60</a></div></div>
<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#l00108">helpers.h:108</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#l00140">helpers.h:140</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#l00304">helpers.h:304</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="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#l00142">helpers.h:142</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="af5751970a4d8c62febdc6c63d6d4fd1d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void pooling_layer_3 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>input_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</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 *&#160;</td>
<td class="paramname"><em>output_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_offset_first_element_in_bytes</em>&#160;</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 3. </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 QS8/QS16/F16/F32; </dd>
<dd>
In case of average pooling the following information must be passed at compile time: -DPOOL_AVG or -DPOOL_L2 must be provided otherwise max pooling will be performed. -DMAX_WIDTH and -DMAX_HEIGHT which are the maximum accessible indeces in x and y dimensions (width + pad) -DSTRIDE_X and -DSTRIDE_Y which are the steps of the window along the x and y directions -DPAD_X and -DPAD_Y which are the pooling paddings in x and y dimension</dd></dl>
<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: QS8/QS16/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#l00286">286</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#l00108">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#l00142">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00304">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="l00289"></a><span class="lineno"> 289</span>&#160;{</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160; <span class="comment">// Get pixels pointer</span></div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> input = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(input);</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> output = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(output);</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160;</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="comment">// Load data</span></div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; data0 = vload3(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0));</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 3)</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; data1 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0));</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 3)</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; data2 = vload3(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0));</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160;<span class="preprocessor"></span> <span class="comment">// Raise to power of 2 for L2 Pooling</span></div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 3);</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160; data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 3);</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; data2 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data2, 3);</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; <span class="comment">// Perform calculations</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data2);</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; DATA_TYPE res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(<a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0.s0, data0.s1), data0.s2);</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160;</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;<span class="preprocessor"></span> <span class="comment">// Divide by pool region in case of average pooling</span></div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; 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="l00317"></a><span class="lineno"> 317</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160;<span class="preprocessor"></span> <span class="comment">// Take square root of the result in L2 pooling</span></div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; <span class="comment">// Store result</span></div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;}</div>
<div class="ttc" id="pooling__layer_8cl_xhtml_a5db17889d824975fefb2ce2f4690637f"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a></div><div class="ttdeci">#define DIV_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00060">pooling_layer.cl:60</a></div></div>
<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#l00108">helpers.h:108</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#l00140">helpers.h:140</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#l00304">helpers.h:304</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="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#l00142">helpers.h:142</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="a46f86250bbe9f5a1cf6c060e72109546"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void pooling_layer_7 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>input_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_stride_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>input_step_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</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 *&#160;</td>
<td class="paramname"><em>output_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_stride_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_step_z</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>output_offset_first_element_in_bytes</em>&#160;</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 7. </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 QS8/QS16/F16/F32; </dd>
<dd>
In case of average pooling the following information must be passed at compile time: -DPOOL_AVG or -DPOOL_L2 must be provided otherwise max pooling will be performed. -DMAX_WIDTH and -DMAX_HEIGHT which are the maximum accessible indeces in x and y dimensions (width + pad) -DSTRIDE_X and -DSTRIDE_Y which are the steps of the window along the x and y directions -DPAD_X and -DPAD_Y which are the pooling paddings in x and y dimension</dd></dl>
<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: QS8/QS16/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#l00424">424</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#l00108">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#l00142">Tensor3D::ptr</a>, <a class="el" href="pooling__layer_8cl_source.xhtml#l00061">SQRT_OP</a>, <a class="el" href="helpers_8h_source.xhtml#l00304">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="l00427"></a><span class="lineno"> 427</span>&#160;{</div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160; <span class="comment">// Get pixels pointer</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> input = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(input);</div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> output = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(output);</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160;</div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160; <span class="comment">// Load data</span></div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)</div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160; data0 = vload8(0, (__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 0, 0));</div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>, 8)</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; data1 = vload8(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 1, 0));</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 8)</div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160; data2 = vload8(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 2, 0));</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 8)</div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160; data3 = vload8(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 3, 0));</div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 8)</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; data4 = vload8(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 4, 0));</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 8)</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; data5 = vload8(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 5, 0));</div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 8)</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; data6 = vload8(0, (__global DATA_TYPE *)<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&amp;input, 0, 6, 0));</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160;</div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160;<span class="preprocessor"></span> <span class="comment">// Raise to power of 2 for L2 Pooling</span></div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data0, 8);</div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; data1 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data1, 8);</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; data2 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data2, 8);</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; data3 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data3, 8);</div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160; data4 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data4, 8);</div>
<div class="line"><a name="l00455"></a><span class="lineno"> 455</span>&#160; data5 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data5, 8);</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; data6 = <a class="code" href="pooling__layer_8cl.xhtml#a03898439d164d74f8c35bafb67262d95">POW2_OP</a>(data6, 8);</div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160; <span class="comment">// Pool operation of all rows</span></div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data1);</div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; data2 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data2, data3);</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160; data4 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data4, data5);</div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data2);</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160; data4 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data4, data6);</div>
<div class="line"><a name="l00465"></a><span class="lineno"> 465</span>&#160; data0 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0, data4);</div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160;</div>
<div class="line"><a name="l00467"></a><span class="lineno"> 467</span>&#160; <span class="comment">// Set last element</span></div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span>&#160;<span class="preprocessor"></span> data0.s7 = 0;</div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span>&#160;<span class="preprocessor">#else </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00471"></a><span class="lineno"> 471</span>&#160;<span class="preprocessor"></span> data0.s7 = data0.s6;</div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00474"></a><span class="lineno"> 474</span>&#160; <span class="comment">// Reduce result</span></div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 4)</div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160; reduce4 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(data0.s0123, data0.s4567);</div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160; <a class="code" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE, 2)</div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160; reduce2 = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(reduce4.s01, reduce4.s23);</div>
<div class="line"><a name="l00479"></a><span class="lineno"> 479</span>&#160; DATA_TYPE res = <a class="code" href="pooling__layer_8cl.xhtml#a482ef7d59a5f474ca126e737c7f0978a">POOL_OP</a>(reduce2.s0, reduce2.s1);</div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160;</div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160;<span class="preprocessor">#if defined(POOL_AVG) || defined(POOL_L2)</span></div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160;<span class="preprocessor"></span> <span class="comment">// Divide by pool region in case of average pooling</span></div>
<div class="line"><a name="l00483"></a><span class="lineno"> 483</span>&#160; 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>(7, MAX_WIDTH, MAX_HEIGHT, PAD_X, PAD_Y, STRIDE_X, STRIDE_Y));</div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_AVG) || defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160;<span class="preprocessor">#if defined(POOL_L2)</span></div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160;<span class="preprocessor"></span> <span class="comment">// Take square root of the result in L2 pooling</span></div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160; res = <a class="code" href="pooling__layer_8cl.xhtml#ac9af19bec38fe50b4b9585c0e5c0ccca">SQRT_OP</a>(res);</div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* defined(POOL_L2) */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160; <span class="comment">// Store result</span></div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160; *(__global DATA_TYPE *)output.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> = res;</div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160;}</div>
<div class="ttc" id="pooling__layer_8cl_xhtml_a5db17889d824975fefb2ce2f4690637f"><div class="ttname"><a href="pooling__layer_8cl.xhtml#a5db17889d824975fefb2ce2f4690637f">DIV_OP</a></div><div class="ttdeci">#define DIV_OP(x, y)</div><div class="ttdef"><b>Definition:</b> <a href="pooling__layer_8cl_source.xhtml#l00060">pooling_layer.cl:60</a></div></div>
<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#l00108">helpers.h:108</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#l00140">helpers.h:140</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#l00304">helpers.h:304</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="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#l00142">helpers.h:142</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>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_55b5a5006e943fb664ff8cff3cfe7768.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_f6c3ae42d7e27145d0a3c3e38ca1c000.xhtml">core</a></li><li class="navelem"><a class="el" href="dir_1b7ae9123c88e650426d50d95c19d414.xhtml">CL</a></li><li class="navelem"><a class="el" href="dir_b7c3d80b0dadb2139bc73b7161751c12.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 Sep 28 2017 14:37:54 for Compute Library by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
</ul>
</div>
</body>
</html>