1 <!-- HTML header for doxygen 1.8.9.1-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7 <meta name="generator" content="Doxygen 1.8.11"/>
8 <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
9 <title>ARM Compute Library: src/core/CL/cl_kernels/convolution_layer.cl File Reference</title>
10 <link href="tabs.css" rel="stylesheet" type="text/css"/>
11 <script type="text/javascript" src="jquery.js"></script>
12 <script type="text/javascript" src="dynsections.js"></script>
13 <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtreedata.js"></script>
16 <script type="text/javascript" src="navtree.js"></script>
17 <script type="text/javascript">
18 $(document).ready(initResizable);
19 $(window).load(resizeHeight);
21 <link href="search/search.css" rel="stylesheet" type="text/css"/>
22 <script type="text/javascript" src="search/searchdata.js"></script>
23 <script type="text/javascript" src="search/search.js"></script>
24 <script type="text/javascript">
25 $(document).ready(function() { init_search(); });
27 <script type="text/x-mathjax-config">
29 extensions: ["tex2jax.js"],
30 jax: ["input/TeX","output/HTML-CSS"],
32 </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
33 <link href="doxygen.css" rel="stylesheet" type="text/css" />
36 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
38 <table cellspacing="0" cellpadding="0">
40 <tr style="height: 56px;">
41 <td style="padding-left: 0.5em;">
42 <div id="projectname">ARM Compute Library
43  <span id="projectnumber">17.04</span>
50 <!-- end header part -->
51 <!-- Generated by Doxygen 1.8.11 -->
52 <script type="text/javascript">
53 var searchBox = new SearchBox("searchBox", "search",false,'Search');
55 <div id="navrow1" class="tabs">
57 <li><a href="index.xhtml"><span>Main Page</span></a></li>
58 <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
59 <li><a href="annotated.xhtml"><span>Data Structures</span></a></li>
60 <li class="current"><a href="files.xhtml"><span>Files</span></a></li>
62 <div id="MSearchBox" class="MSearchBoxInactive">
64 <img id="MSearchSelect" src="search/mag_sel.png"
65 onmouseover="return searchBox.OnSearchSelectShow()"
66 onmouseout="return searchBox.OnSearchSelectHide()"
68 <input type="text" id="MSearchField" value="Search" accesskey="S"
69 onfocus="searchBox.OnSearchFieldFocus(true)"
70 onblur="searchBox.OnSearchFieldFocus(false)"
71 onkeyup="searchBox.OnSearchFieldChange(event)"/>
72 </span><span class="right">
73 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
79 <div id="navrow2" class="tabs2">
81 <li><a href="files.xhtml"><span>File List</span></a></li>
82 <li><a href="globals.xhtml"><span>Globals</span></a></li>
86 <div id="side-nav" class="ui-resizable side-nav-resizable">
88 <div id="nav-tree-contents">
89 <div id="nav-sync" class="sync"></div>
92 <div id="splitbar" style="-moz-user-select:none;"
93 class="ui-resizable-handle">
96 <script type="text/javascript">
97 $(document).ready(function(){initNavTree('convolution__layer_8cl.xhtml','');});
99 <div id="doc-content">
100 <!-- window showing the filter options -->
101 <div id="MSearchSelectWindow"
102 onmouseover="return searchBox.OnSearchSelectShow()"
103 onmouseout="return searchBox.OnSearchSelectHide()"
104 onkeydown="return searchBox.OnSearchSelectKey(event)">
107 <!-- iframe showing the search results (closed by default) -->
108 <div id="MSearchResultsWindow">
109 <iframe src="javascript:void(0)" frameborder="0"
110 name="MSearchResults" id="MSearchResults">
115 <div class="summary">
116 <a href="#func-members">Functions</a> </div>
117 <div class="headertitle">
118 <div class="title">convolution_layer.cl File Reference</div> </div>
120 <div class="contents">
121 <div class="textblock"><code>#include "<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>"</code><br />
123 <p><a href="convolution__layer_8cl_source.xhtml">Go to the source code of this file.</a></p>
124 <table class="memberdecls">
125 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
126 Functions</h2></td></tr>
127 <tr class="memitem:a229c10cbfba415bce4cc33d4530bfbd0"><td class="memItemLeft" align="right" valign="top">__kernel void </td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#a229c10cbfba415bce4cc33d4530bfbd0">reshape_to_columns</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_stride_z, uint src_step_z, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes, __global uchar *bias_ptr, uint bias_stride_x, uint bias_step_x, uint bias_stride_y, uint bias_step_y, uint bias_offset_first_element_in_bytes, uint width, uint height)</td></tr>
128 <tr class="memdesc:a229c10cbfba415bce4cc33d4530bfbd0"><td class="mdescLeft"> </td><td class="mdescRight">This kernel reshapes the tensor's low three dimensions to single column. <a href="#a229c10cbfba415bce4cc33d4530bfbd0">More...</a><br /></td></tr>
129 <tr class="separator:a229c10cbfba415bce4cc33d4530bfbd0"><td class="memSeparator" colspan="2"> </td></tr>
130 <tr class="memitem:afaddfccc926506181141b2dc86cb73f1"><td class="memItemLeft" align="right" valign="top">__kernel void </td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#afaddfccc926506181141b2dc86cb73f1">im2col_generic</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_stride_z, uint src_step_z, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes, int kernel_size, int kernel_depth, int width, int2 input_dims, int2 strides, int2 paddings)</td></tr>
131 <tr class="memdesc:afaddfccc926506181141b2dc86cb73f1"><td class="mdescLeft"> </td><td class="mdescRight">This kernel performs a reshaping of the input tensor to a tensor used to perform convolution using GEMM. <a href="#afaddfccc926506181141b2dc86cb73f1">More...</a><br /></td></tr>
132 <tr class="separator:afaddfccc926506181141b2dc86cb73f1"><td class="memSeparator" colspan="2"> </td></tr>
133 <tr class="memitem:af11bad06b2f7c26cc6ee2f93add5dcbf"><td class="memItemLeft" align="right" valign="top">__kernel void </td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#af11bad06b2f7c26cc6ee2f93add5dcbf">col2im</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_stride_z, uint dst_step_z, uint dst_offset_first_element_in_bytes, uint width)</td></tr>
134 <tr class="memdesc:af11bad06b2f7c26cc6ee2f93add5dcbf"><td class="mdescLeft"> </td><td class="mdescRight">This kernel performs a reshaping of the output of the convolution layer. <a href="#af11bad06b2f7c26cc6ee2f93add5dcbf">More...</a><br /></td></tr>
135 <tr class="separator:af11bad06b2f7c26cc6ee2f93add5dcbf"><td class="memSeparator" colspan="2"> </td></tr>
136 <tr class="memitem:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="memItemLeft" align="right" valign="top">__kernel void </td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#a6f31f2c8d606e1b57d9bdfacd416024c">im2col_reduced</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_stride_z, uint src_step_z, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_offset_first_element_in_bytes, uint width, uint height)</td></tr>
137 <tr class="memdesc:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="mdescLeft"> </td><td class="mdescRight">This kernel reshapes the tensor's low three dimensions to single row for GEMM operation. <a href="#a6f31f2c8d606e1b57d9bdfacd416024c">More...</a><br /></td></tr>
138 <tr class="separator:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="memSeparator" colspan="2"> </td></tr>
140 <h2 class="groupheader">Function Documentation</h2>
141 <a class="anchor" id="af11bad06b2f7c26cc6ee2f93add5dcbf"></a>
142 <div class="memitem">
143 <div class="memproto">
144 <table class="memname">
146 <td class="memname">__kernel void col2im </td>
148 <td class="paramtype">__global uchar * </td>
149 <td class="paramname"><em>src_ptr</em>, </td>
152 <td class="paramkey"></td>
154 <td class="paramtype">uint </td>
155 <td class="paramname"><em>src_stride_x</em>, </td>
158 <td class="paramkey"></td>
160 <td class="paramtype">uint </td>
161 <td class="paramname"><em>src_step_x</em>, </td>
164 <td class="paramkey"></td>
166 <td class="paramtype">uint </td>
167 <td class="paramname"><em>src_stride_y</em>, </td>
170 <td class="paramkey"></td>
172 <td class="paramtype">uint </td>
173 <td class="paramname"><em>src_step_y</em>, </td>
176 <td class="paramkey"></td>
178 <td class="paramtype">uint </td>
179 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
182 <td class="paramkey"></td>
184 <td class="paramtype">__global uchar * </td>
185 <td class="paramname"><em>dst_ptr</em>, </td>
188 <td class="paramkey"></td>
190 <td class="paramtype">uint </td>
191 <td class="paramname"><em>dst_stride_x</em>, </td>
194 <td class="paramkey"></td>
196 <td class="paramtype">uint </td>
197 <td class="paramname"><em>dst_step_x</em>, </td>
200 <td class="paramkey"></td>
202 <td class="paramtype">uint </td>
203 <td class="paramname"><em>dst_stride_y</em>, </td>
206 <td class="paramkey"></td>
208 <td class="paramtype">uint </td>
209 <td class="paramname"><em>dst_step_y</em>, </td>
212 <td class="paramkey"></td>
214 <td class="paramtype">uint </td>
215 <td class="paramname"><em>dst_stride_z</em>, </td>
218 <td class="paramkey"></td>
220 <td class="paramtype">uint </td>
221 <td class="paramname"><em>dst_step_z</em>, </td>
224 <td class="paramkey"></td>
226 <td class="paramtype">uint </td>
227 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
230 <td class="paramkey"></td>
232 <td class="paramtype">uint </td>
233 <td class="paramname"><em>width</em> </td>
241 </div><div class="memdoc">
243 <p>This kernel performs a reshaping of the output of the convolution layer. </p>
244 <dl class="section note"><dt>Note</dt><dd>The data type must be passed at compile time using -DDATA_TYPE: e.g. -DDATA_TYPE=float</dd></dl>
245 <dl class="params"><dt>Parameters</dt><dd>
246 <table class="params">
247 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: F16, F32 </td></tr>
248 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
249 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
250 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source tensor in Y dimension (in bytes) </td></tr>
251 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
252 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
253 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Supported data types: F16, F32 </td></tr>
254 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
255 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
256 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination tensor in Y dimension (in bytes) </td></tr>
257 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
258 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_z</td><td>Stride of the destination tensor in Z dimension (in bytes) </td></tr>
259 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_z</td><td>dst_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
260 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
261 <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The output tensor width </td></tr>
266 <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00175">175</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p>
268 <p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00083">CONVERT_TO_TENSOR3D_STRUCT_NO_STEP</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>, <a class="el" href="helpers_8h_source.xhtml#l00106">Tensor3D::ptr</a>, <a class="el" href="helpers_8h_source.xhtml#l00108">Tensor3D::stride_x</a>, <a class="el" href="helpers_8h_source.xhtml#l00109">Tensor3D::stride_y</a>, and <a class="el" href="helpers_8h_source.xhtml#l00110">Tensor3D::stride_z</a>.</p>
269 <div class="fragment"><div class="line"><a name="l00179"></a><span class="lineno"> 179</span> {</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> dst = <a class="code" href="helpers_8h.xhtml#a79e8e562daa6599317d2d1cd86ef1bf2">CONVERT_TO_TENSOR3D_STRUCT_NO_STEP</a>(dst);</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> </div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keywordtype">int</span> idx = get_global_id(0) * dst.<a class="code" href="struct_tensor3_d.xhtml#ad5ff7a2b2bd0eec50fe09c254b127d1c">stride_z</a> + (get_global_id(1) / width) * dst.<a class="code" href="struct_tensor3_d.xhtml#a4f0b90c9ecd6e57ceb3f37332fefe8f1">stride_y</a> + (get_global_id(1) % width) * dst.<a class="code" href="struct_tensor3_d.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">stride_x</a>;</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  __global uchar *tmp_out_ptr = dst.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> + idx;</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(src.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>));</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> }</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>
270 <div class="ttc" id="struct_tensor3_d_xhtml_ad5ff7a2b2bd0eec50fe09c254b127d1c"><div class="ttname"><a href="struct_tensor3_d.xhtml#ad5ff7a2b2bd0eec50fe09c254b127d1c">Tensor3D::stride_z</a></div><div class="ttdeci">int stride_z</div><div class="ttdoc">Stride of the image in Z dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00110">helpers.h:110</a></div></div>
271 <div class="ttc" id="struct_tensor3_d_xhtml_ae01febbfd0689ef709f3ff6fdd2abc7e"><div class="ttname"><a href="struct_tensor3_d.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">Tensor3D::stride_x</a></div><div class="ttdeci">int stride_x</div><div class="ttdoc">Stride of the image in X dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00108">helpers.h:108</a></div></div>
272 <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#l00104">helpers.h:104</a></div></div>
273 <div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
274 <div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
275 <div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
276 <div class="ttc" id="helpers_8h_xhtml_a79e8e562daa6599317d2d1cd86ef1bf2"><div class="ttname"><a href="helpers_8h.xhtml#a79e8e562daa6599317d2d1cd86ef1bf2">CONVERT_TO_TENSOR3D_STRUCT_NO_STEP</a></div><div class="ttdeci">#define CONVERT_TO_TENSOR3D_STRUCT_NO_STEP(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00083">helpers.h:83</a></div></div>
277 <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#l00106">helpers.h:106</a></div></div>
278 <div class="ttc" id="struct_tensor3_d_xhtml_a4f0b90c9ecd6e57ceb3f37332fefe8f1"><div class="ttname"><a href="struct_tensor3_d.xhtml#a4f0b90c9ecd6e57ceb3f37332fefe8f1">Tensor3D::stride_y</a></div><div class="ttdeci">int stride_y</div><div class="ttdoc">Stride of the image in Y dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00109">helpers.h:109</a></div></div>
279 </div><!-- fragment -->
282 <a class="anchor" id="afaddfccc926506181141b2dc86cb73f1"></a>
283 <div class="memitem">
284 <div class="memproto">
285 <table class="memname">
287 <td class="memname">__kernel void im2col_generic </td>
289 <td class="paramtype">__global uchar * </td>
290 <td class="paramname"><em>src_ptr</em>, </td>
293 <td class="paramkey"></td>
295 <td class="paramtype">uint </td>
296 <td class="paramname"><em>src_stride_x</em>, </td>
299 <td class="paramkey"></td>
301 <td class="paramtype">uint </td>
302 <td class="paramname"><em>src_step_x</em>, </td>
305 <td class="paramkey"></td>
307 <td class="paramtype">uint </td>
308 <td class="paramname"><em>src_stride_y</em>, </td>
311 <td class="paramkey"></td>
313 <td class="paramtype">uint </td>
314 <td class="paramname"><em>src_step_y</em>, </td>
317 <td class="paramkey"></td>
319 <td class="paramtype">uint </td>
320 <td class="paramname"><em>src_stride_z</em>, </td>
323 <td class="paramkey"></td>
325 <td class="paramtype">uint </td>
326 <td class="paramname"><em>src_step_z</em>, </td>
329 <td class="paramkey"></td>
331 <td class="paramtype">uint </td>
332 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
335 <td class="paramkey"></td>
337 <td class="paramtype">__global uchar * </td>
338 <td class="paramname"><em>dst_ptr</em>, </td>
341 <td class="paramkey"></td>
343 <td class="paramtype">uint </td>
344 <td class="paramname"><em>dst_stride_x</em>, </td>
347 <td class="paramkey"></td>
349 <td class="paramtype">uint </td>
350 <td class="paramname"><em>dst_step_x</em>, </td>
353 <td class="paramkey"></td>
355 <td class="paramtype">uint </td>
356 <td class="paramname"><em>dst_stride_y</em>, </td>
359 <td class="paramkey"></td>
361 <td class="paramtype">uint </td>
362 <td class="paramname"><em>dst_step_y</em>, </td>
365 <td class="paramkey"></td>
367 <td class="paramtype">uint </td>
368 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
371 <td class="paramkey"></td>
373 <td class="paramtype">int </td>
374 <td class="paramname"><em>kernel_size</em>, </td>
377 <td class="paramkey"></td>
379 <td class="paramtype">int </td>
380 <td class="paramname"><em>kernel_depth</em>, </td>
383 <td class="paramkey"></td>
385 <td class="paramtype">int </td>
386 <td class="paramname"><em>width</em>, </td>
389 <td class="paramkey"></td>
391 <td class="paramtype">int2 </td>
392 <td class="paramname"><em>input_dims</em>, </td>
395 <td class="paramkey"></td>
397 <td class="paramtype">int2 </td>
398 <td class="paramname"><em>strides</em>, </td>
401 <td class="paramkey"></td>
403 <td class="paramtype">int2 </td>
404 <td class="paramname"><em>paddings</em> </td>
412 </div><div class="memdoc">
414 <p>This kernel performs a reshaping of the input tensor to a tensor used to perform convolution using GEMM. </p>
415 <dl class="section note"><dt>Note</dt><dd>The data type must be passed at compile time using -DDATA_TYPE: e.g. -DDATA_TYPE=float </dd>
417 In case biases will be added to the convolution -DHAS_BIAS has to be passed to append the final matrix with 1 in each row.</dd></dl>
418 <dl class="params"><dt>Parameters</dt><dd>
419 <table class="params">
420 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: F16, F32 </td></tr>
421 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
422 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
423 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source tensor in Y dimension (in bytes) </td></tr>
424 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
425 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
426 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_z</td><td>src_stride_z * number of elements along Z processed per workitem(in bytes) </td></tr>
427 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
428 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Supported data types: F16, F32 </td></tr>
429 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
430 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
431 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination tensor in Y dimension (in bytes) </td></tr>
432 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
433 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
434 <tr><td class="paramdir">[in]</td><td class="paramname">kernel_size</td><td>The convolution kernel size </td></tr>
435 <tr><td class="paramdir">[in]</td><td class="paramname">kernel_depth</td><td>The kernel depth </td></tr>
436 <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The output tensor width </td></tr>
437 <tr><td class="paramdir">[in]</td><td class="paramname">input_dims</td><td>The input tensor dimensions </td></tr>
438 <tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>The strides of the im2col operation </td></tr>
439 <tr><td class="paramdir">[in]</td><td class="paramname">paddings</td><td>The input tensor paddings </td></tr>
444 <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00105">105</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p>
446 <p>References <a class="el" href="helpers_8h_source.xhtml#l00076">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>, <a class="el" href="helpers_8h_source.xhtml#l00079">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>, <a class="el" href="helpers_8h_source.xhtml#l00099">Image::stride_x</a>, <a class="el" href="helpers_8h_source.xhtml#l00100">Image::stride_y</a>, and <a class="el" href="helpers_8h_source.xhtml#l00213">tensor3D_offset()</a>.</p>
447 <div class="fragment"><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> src = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(src);</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <a class="code" href="struct_image.xhtml">Image</a> dst = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(dst);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span> </div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="comment">// Kernel radius</span></div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordtype">int</span> KH = kernel_size >> 1;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="comment">// Determine output index</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  uint idx = (get_global_id(1) * width + get_global_id(0)) * dst.<a class="code" href="struct_image.xhtml#a4f0b90c9ecd6e57ceb3f37332fefe8f1">stride_y</a>;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  __global uchar *tmp_out_ptr = dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> + idx;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="comment">// Determine current input index</span></div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> wi = get_global_id(0) * strides.x - paddings.x;</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> hi = get_global_id(1) * strides.y - paddings.y;</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> </div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="comment">// Linearize convolution elements</span></div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> d = 0; d < kernel_depth; ++d)</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">int</span> cur_h = hi;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> h = -KH; h <= KH; ++h, ++cur_h)</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordtype">int</span> cur_w = wi;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> w = -KH; w <= KH; ++w, ++cur_w)</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  {</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">if</span>(((cur_w < 0) || (cur_w >= input_dims.x)) || ((cur_h < 0) || (cur_h >= input_dims.y)))</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = 0;</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  }</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  {</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(<a class="code" href="helpers_8h.xhtml#a2101b2fe0193ce227ae4e0945e321d85">tensor3D_offset</a>(&src, w, h, d)));</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  }</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  tmp_out_ptr += dst.<a class="code" href="struct_image.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">stride_x</a>;</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  }</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  }</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  }</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = (<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>)(1);</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> }</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#l00079">helpers.h:79</a></div></div>
448 <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>
449 <div class="ttc" id="helpers_8h_xhtml_a4334a4a76f8e9628c0fb9e1acf616e2a"><div class="ttname"><a href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT_NO_STEP(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00076">helpers.h:76</a></div></div>
450 <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#l00104">helpers.h:104</a></div></div>
451 <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#l00213">helpers.h:213</a></div></div>
452 <div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
453 <div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
454 <div class="ttc" id="struct_image_xhtml_a4f0b90c9ecd6e57ceb3f37332fefe8f1"><div class="ttname"><a href="struct_image.xhtml#a4f0b90c9ecd6e57ceb3f37332fefe8f1">Image::stride_y</a></div><div class="ttdeci">int stride_y</div><div class="ttdoc">Stride of the image in Y dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00100">helpers.h:100</a></div></div>
455 <div class="ttc" id="struct_image_xhtml_ae01febbfd0689ef709f3ff6fdd2abc7e"><div class="ttname"><a href="struct_image.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">Image::stride_x</a></div><div class="ttdeci">int stride_x</div><div class="ttdoc">Stride of the image in X dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00099">helpers.h:99</a></div></div>
456 </div><!-- fragment -->
459 <a class="anchor" id="a6f31f2c8d606e1b57d9bdfacd416024c"></a>
460 <div class="memitem">
461 <div class="memproto">
462 <table class="memname">
464 <td class="memname">__kernel void im2col_reduced </td>
466 <td class="paramtype">__global uchar * </td>
467 <td class="paramname"><em>src_ptr</em>, </td>
470 <td class="paramkey"></td>
472 <td class="paramtype">uint </td>
473 <td class="paramname"><em>src_stride_x</em>, </td>
476 <td class="paramkey"></td>
478 <td class="paramtype">uint </td>
479 <td class="paramname"><em>src_step_x</em>, </td>
482 <td class="paramkey"></td>
484 <td class="paramtype">uint </td>
485 <td class="paramname"><em>src_stride_y</em>, </td>
488 <td class="paramkey"></td>
490 <td class="paramtype">uint </td>
491 <td class="paramname"><em>src_step_y</em>, </td>
494 <td class="paramkey"></td>
496 <td class="paramtype">uint </td>
497 <td class="paramname"><em>src_stride_z</em>, </td>
500 <td class="paramkey"></td>
502 <td class="paramtype">uint </td>
503 <td class="paramname"><em>src_step_z</em>, </td>
506 <td class="paramkey"></td>
508 <td class="paramtype">uint </td>
509 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
512 <td class="paramkey"></td>
514 <td class="paramtype">__global uchar * </td>
515 <td class="paramname"><em>dst_ptr</em>, </td>
518 <td class="paramkey"></td>
520 <td class="paramtype">uint </td>
521 <td class="paramname"><em>dst_stride_x</em>, </td>
524 <td class="paramkey"></td>
526 <td class="paramtype">uint </td>
527 <td class="paramname"><em>dst_step_x</em>, </td>
530 <td class="paramkey"></td>
532 <td class="paramtype">uint </td>
533 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
536 <td class="paramkey"></td>
538 <td class="paramtype">uint </td>
539 <td class="paramname"><em>width</em>, </td>
542 <td class="paramkey"></td>
544 <td class="paramtype">uint </td>
545 <td class="paramname"><em>height</em> </td>
553 </div><div class="memdoc">
555 <p>This kernel reshapes the tensor's low three dimensions to single row for GEMM operation. </p>
556 <dl class="section note"><dt>Note</dt><dd>Datatype should be given as a preprocessor argument using -DDATA_TYPE=type. e.g. -DDATA_TYPE=float </dd>
558 In case biases will be added in late stage, -DHAS_BIAS has to be passed to append the final matrix with 1 in each row.</dd></dl>
559 <dl class="params"><dt>Parameters</dt><dd>
560 <table class="params">
561 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: F16, F32 </td></tr>
562 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
563 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
564 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source tensor in Y dimension (in bytes) </td></tr>
565 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
566 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
567 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_z</td><td>src_stride_z * number of elements along Y processed per workitem(in bytes) </td></tr>
568 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
569 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Same as input. </td></tr>
570 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
571 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
572 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
573 <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the input tensor </td></tr>
574 <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the input tensor </td></tr>
579 <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00208">208</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p>
581 <p>References <a class="el" href="helpers_8h_source.xhtml#l00079">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, and <a class="el" href="helpers_8h_source.xhtml#l00106">Tensor3D::ptr</a>.</p>
582 <div class="fragment"><div class="line"><a name="l00212"></a><span class="lineno"> 212</span> {</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> src = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(src);</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span> </div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <span class="keyword">const</span> uint image_size = width * height;</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  __global uchar *tmp_out_ptr = dst_ptr + dst_offset_first_element_in_bytes + (get_global_id(0) + get_global_id(1) * width + get_global_id(2) * image_size) * dst_stride_x;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span> </div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)src.ptr);</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span> </div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  <span class="comment">// If it is the last thread in the 3 dimensional workgroup</span></div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <span class="keywordflow">if</span>(get_global_id(0) == (get_global_size(0) - 1) && get_global_id(1) == (get_global_size(1) - 1) && get_global_id(2) == (get_global_size(2) - 1))</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  {</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  tmp_out_ptr += dst_stride_x;</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = (<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>)1;</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  }</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span> }</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#l00079">helpers.h:79</a></div></div>
583 <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>
584 <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#l00104">helpers.h:104</a></div></div>
585 </div><!-- fragment -->
588 <a class="anchor" id="a229c10cbfba415bce4cc33d4530bfbd0"></a>
589 <div class="memitem">
590 <div class="memproto">
591 <table class="memname">
593 <td class="memname">__kernel void reshape_to_columns </td>
595 <td class="paramtype">__global uchar * </td>
596 <td class="paramname"><em>src_ptr</em>, </td>
599 <td class="paramkey"></td>
601 <td class="paramtype">uint </td>
602 <td class="paramname"><em>src_stride_x</em>, </td>
605 <td class="paramkey"></td>
607 <td class="paramtype">uint </td>
608 <td class="paramname"><em>src_step_x</em>, </td>
611 <td class="paramkey"></td>
613 <td class="paramtype">uint </td>
614 <td class="paramname"><em>src_stride_y</em>, </td>
617 <td class="paramkey"></td>
619 <td class="paramtype">uint </td>
620 <td class="paramname"><em>src_step_y</em>, </td>
623 <td class="paramkey"></td>
625 <td class="paramtype">uint </td>
626 <td class="paramname"><em>src_stride_z</em>, </td>
629 <td class="paramkey"></td>
631 <td class="paramtype">uint </td>
632 <td class="paramname"><em>src_step_z</em>, </td>
635 <td class="paramkey"></td>
637 <td class="paramtype">uint </td>
638 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
641 <td class="paramkey"></td>
643 <td class="paramtype">__global uchar * </td>
644 <td class="paramname"><em>dst_ptr</em>, </td>
647 <td class="paramkey"></td>
649 <td class="paramtype">uint </td>
650 <td class="paramname"><em>dst_stride_x</em>, </td>
653 <td class="paramkey"></td>
655 <td class="paramtype">uint </td>
656 <td class="paramname"><em>dst_step_x</em>, </td>
659 <td class="paramkey"></td>
661 <td class="paramtype">uint </td>
662 <td class="paramname"><em>dst_stride_y</em>, </td>
665 <td class="paramkey"></td>
667 <td class="paramtype">uint </td>
668 <td class="paramname"><em>dst_step_y</em>, </td>
671 <td class="paramkey"></td>
673 <td class="paramtype">uint </td>
674 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
677 <td class="paramkey"></td>
679 <td class="paramtype">__global uchar * </td>
680 <td class="paramname"><em>bias_ptr</em>, </td>
683 <td class="paramkey"></td>
685 <td class="paramtype">uint </td>
686 <td class="paramname"><em>bias_stride_x</em>, </td>
689 <td class="paramkey"></td>
691 <td class="paramtype">uint </td>
692 <td class="paramname"><em>bias_step_x</em>, </td>
695 <td class="paramkey"></td>
697 <td class="paramtype">uint </td>
698 <td class="paramname"><em>bias_stride_y</em>, </td>
701 <td class="paramkey"></td>
703 <td class="paramtype">uint </td>
704 <td class="paramname"><em>bias_step_y</em>, </td>
707 <td class="paramkey"></td>
709 <td class="paramtype">uint </td>
710 <td class="paramname"><em>bias_offset_first_element_in_bytes</em>, </td>
713 <td class="paramkey"></td>
715 <td class="paramtype">uint </td>
716 <td class="paramname"><em>width</em>, </td>
719 <td class="paramkey"></td>
721 <td class="paramtype">uint </td>
722 <td class="paramname"><em>height</em> </td>
730 </div><div class="memdoc">
732 <p>This kernel reshapes the tensor's low three dimensions to single column. </p>
733 <dl class="section note"><dt>Note</dt><dd>Datatype should be given as a preprocessor argument using -DDATA_TYPE=type. e.g. -DDATA_TYPE=short</dd></dl>
734 <dl class="params"><dt>Parameters</dt><dd>
735 <table class="params">
736 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: F16, F32 </td></tr>
737 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
738 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
739 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source tensor in Y dimension (in bytes) </td></tr>
740 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
741 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
742 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_z</td><td>src_stride_z * number of elements along Y processed per workitem(in bytes) </td></tr>
743 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
744 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Same as input </td></tr>
745 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
746 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
747 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination tensor in Y dimension (in bytes) </td></tr>
748 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
749 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
750 <tr><td class="paramdir">[in]</td><td class="paramname">bias_ptr</td><td>Pointer to the bias tensor. Same as input </td></tr>
751 <tr><td class="paramdir">[in]</td><td class="paramname">bias_stride_x</td><td>Stride of the bias tensor in X dimension (in bytes) </td></tr>
752 <tr><td class="paramdir">[in]</td><td class="paramname">bias_step_x</td><td>bias_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
753 <tr><td class="paramdir">[in]</td><td class="paramname">bias_stride_y</td><td>Stride of the bias tensor in Y dimension (in bytes) </td></tr>
754 <tr><td class="paramdir">[in]</td><td class="paramname">bias_step_y</td><td>bias_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
755 <tr><td class="paramdir">[in]</td><td class="paramname">bias_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
756 <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the input tensor </td></tr>
757 <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the input tensor </td></tr>
762 <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00053">53</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p>
764 <p>References <a class="el" href="helpers_8h_source.xhtml#l00079">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, and <a class="el" href="helpers_8h_source.xhtml#l00106">Tensor3D::ptr</a>.</p>
765 <div class="fragment"><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> {</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> src = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(src);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  __global uchar *tmp_out_ptr = dst_ptr + dst_offset_first_element_in_bytes + get_global_id(0) * dst_stride_y</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  + get_global_id(1) * width * dst_stride_y + get_global_id(2) * width * height * dst_stride_y;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)src.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="comment">// If it is the last thread in the 3 dimensional workgroup</span></div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">if</span>(get_global_id(0) == (get_global_size(0) - 1) && get_global_id(1) == (get_global_size(1) - 1) && get_global_id(2) == (get_global_size(2) - 1))</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  {</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  tmp_out_ptr += dst_stride_y;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(bias_ptr + bias_offset_first_element_in_bytes));</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  }</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> }</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#l00079">helpers.h:79</a></div></div>
766 <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>
767 <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#l00104">helpers.h:104</a></div></div>
768 <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#l00106">helpers.h:106</a></div></div>
769 </div><!-- fragment -->
772 </div><!-- contents -->
773 </div><!-- doc-content -->
774 <!-- start footer part -->
775 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
777 <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="convolution__layer_8cl.xhtml">convolution_layer.cl</a></li>
778 <li class="footer">Generated on Wed Apr 12 2017 14:26:05 for ARM Compute Library by
779 <a href="http://www.doxygen.org/index.html">
780 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>