Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 1 | <!-- HTML header for doxygen 1.8.9.1--> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 6 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 7 | <meta name="generator" content="Doxygen 1.8.11"/> |
| 8 | <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines --> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 9 | <title>Compute Library: src/core/CL/cl_kernels/convolution_layer.cl File Reference</title> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 10 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 11 | <script type="text/javascript" src="jquery.js"></script> |
| 12 | <script type="text/javascript" src="dynsections.js"></script> |
| 13 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 14 | <script type="text/javascript" src="resize.js"></script> |
| 15 | <script type="text/javascript" src="navtreedata.js"></script> |
| 16 | <script type="text/javascript" src="navtree.js"></script> |
| 17 | <script type="text/javascript"> |
| 18 | $(document).ready(initResizable); |
| 19 | $(window).load(resizeHeight); |
| 20 | </script> |
| 21 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 22 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 23 | <script type="text/javascript" src="search/search.js"></script> |
| 24 | <script type="text/javascript"> |
| 25 | $(document).ready(function() { init_search(); }); |
| 26 | </script> |
| 27 | <script type="text/x-mathjax-config"> |
| 28 | MathJax.Hub.Config({ |
| 29 | extensions: ["tex2jax.js"], |
| 30 | jax: ["input/TeX","output/HTML-CSS"], |
| 31 | }); |
| 32 | </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> |
| 33 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 34 | </head> |
| 35 | <body> |
| 36 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 37 | <div id="titlearea"> |
| 38 | <table cellspacing="0" cellpadding="0"> |
| 39 | <tbody> |
| 40 | <tr style="height: 56px;"> |
| 41 | <td style="padding-left: 0.5em;"> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 42 | <div id="projectname">Compute Library |
| 43 |  <span id="projectnumber">v17.06</span> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 44 | </div> |
| 45 | </td> |
| 46 | </tr> |
| 47 | </tbody> |
| 48 | </table> |
| 49 | </div> |
| 50 | <!-- end header part --> |
| 51 | <!-- Generated by Doxygen 1.8.11 --> |
| 52 | <script type="text/javascript"> |
| 53 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 54 | </script> |
| 55 | <div id="navrow1" class="tabs"> |
| 56 | <ul class="tablist"> |
| 57 | <li><a href="index.xhtml"><span>Main Page</span></a></li> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 58 | <li><a href="pages.xhtml"><span>Related Pages</span></a></li> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 59 | <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li> |
| 60 | <li><a href="annotated.xhtml"><span>Data Structures</span></a></li> |
| 61 | <li class="current"><a href="files.xhtml"><span>Files</span></a></li> |
| 62 | <li> |
| 63 | <div id="MSearchBox" class="MSearchBoxInactive"> |
| 64 | <span class="left"> |
| 65 | <img id="MSearchSelect" src="search/mag_sel.png" |
| 66 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 67 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 68 | alt=""/> |
| 69 | <input type="text" id="MSearchField" value="Search" accesskey="S" |
| 70 | onfocus="searchBox.OnSearchFieldFocus(true)" |
| 71 | onblur="searchBox.OnSearchFieldFocus(false)" |
| 72 | onkeyup="searchBox.OnSearchFieldChange(event)"/> |
| 73 | </span><span class="right"> |
| 74 | <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> |
| 75 | </span> |
| 76 | </div> |
| 77 | </li> |
| 78 | </ul> |
| 79 | </div> |
| 80 | <div id="navrow2" class="tabs2"> |
| 81 | <ul class="tablist"> |
| 82 | <li><a href="files.xhtml"><span>File List</span></a></li> |
| 83 | <li><a href="globals.xhtml"><span>Globals</span></a></li> |
| 84 | </ul> |
| 85 | </div> |
| 86 | </div><!-- top --> |
| 87 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 88 | <div id="nav-tree"> |
| 89 | <div id="nav-tree-contents"> |
| 90 | <div id="nav-sync" class="sync"></div> |
| 91 | </div> |
| 92 | </div> |
| 93 | <div id="splitbar" style="-moz-user-select:none;" |
| 94 | class="ui-resizable-handle"> |
| 95 | </div> |
| 96 | </div> |
| 97 | <script type="text/javascript"> |
| 98 | $(document).ready(function(){initNavTree('convolution__layer_8cl.xhtml','');}); |
| 99 | </script> |
| 100 | <div id="doc-content"> |
| 101 | <!-- window showing the filter options --> |
| 102 | <div id="MSearchSelectWindow" |
| 103 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 104 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 105 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 106 | </div> |
| 107 | |
| 108 | <!-- iframe showing the search results (closed by default) --> |
| 109 | <div id="MSearchResultsWindow"> |
| 110 | <iframe src="javascript:void(0)" frameborder="0" |
| 111 | name="MSearchResults" id="MSearchResults"> |
| 112 | </iframe> |
| 113 | </div> |
| 114 | |
| 115 | <div class="header"> |
| 116 | <div class="summary"> |
| 117 | <a href="#func-members">Functions</a> </div> |
| 118 | <div class="headertitle"> |
| 119 | <div class="title">convolution_layer.cl File Reference</div> </div> |
| 120 | </div><!--header--> |
| 121 | <div class="contents"> |
| 122 | <div class="textblock"><code>#include "<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>"</code><br /> |
| 123 | </div> |
| 124 | <p><a href="convolution__layer_8cl_source.xhtml">Go to the source code of this file.</a></p> |
| 125 | <table class="memberdecls"> |
| 126 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 127 | Functions</h2></td></tr> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 128 | <tr class="memitem:ab6358b28d1e7bc946950075d94412013"><td class="memItemLeft" align="right" valign="top">__kernel void </td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#ab6358b28d1e7bc946950075d94412013">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_offset_first_element_in_bytes, uint width, uint height, uint depth, uint total_filters)</td></tr> |
| 129 | <tr class="memdesc:ab6358b28d1e7bc946950075d94412013"><td class="mdescLeft"> </td><td class="mdescRight">This kernel reshapes the tensor's low three dimensions to single column. <a href="#ab6358b28d1e7bc946950075d94412013">More...</a><br /></td></tr> |
| 130 | <tr class="separator:ab6358b28d1e7bc946950075d94412013"><td class="memSeparator" colspan="2"> </td></tr> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 131 | <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> |
| 132 | <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> |
| 133 | <tr class="separator:afaddfccc926506181141b2dc86cb73f1"><td class="memSeparator" colspan="2"> </td></tr> |
| 134 | <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> |
| 135 | <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> |
| 136 | <tr class="separator:af11bad06b2f7c26cc6ee2f93add5dcbf"><td class="memSeparator" colspan="2"> </td></tr> |
| 137 | <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> |
| 138 | <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> |
| 139 | <tr class="separator:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="memSeparator" colspan="2"> </td></tr> |
| 140 | </table> |
| 141 | <h2 class="groupheader">Function Documentation</h2> |
| 142 | <a class="anchor" id="af11bad06b2f7c26cc6ee2f93add5dcbf"></a> |
| 143 | <div class="memitem"> |
| 144 | <div class="memproto"> |
| 145 | <table class="memname"> |
| 146 | <tr> |
| 147 | <td class="memname">__kernel void col2im </td> |
| 148 | <td>(</td> |
| 149 | <td class="paramtype">__global uchar * </td> |
| 150 | <td class="paramname"><em>src_ptr</em>, </td> |
| 151 | </tr> |
| 152 | <tr> |
| 153 | <td class="paramkey"></td> |
| 154 | <td></td> |
| 155 | <td class="paramtype">uint </td> |
| 156 | <td class="paramname"><em>src_stride_x</em>, </td> |
| 157 | </tr> |
| 158 | <tr> |
| 159 | <td class="paramkey"></td> |
| 160 | <td></td> |
| 161 | <td class="paramtype">uint </td> |
| 162 | <td class="paramname"><em>src_step_x</em>, </td> |
| 163 | </tr> |
| 164 | <tr> |
| 165 | <td class="paramkey"></td> |
| 166 | <td></td> |
| 167 | <td class="paramtype">uint </td> |
| 168 | <td class="paramname"><em>src_stride_y</em>, </td> |
| 169 | </tr> |
| 170 | <tr> |
| 171 | <td class="paramkey"></td> |
| 172 | <td></td> |
| 173 | <td class="paramtype">uint </td> |
| 174 | <td class="paramname"><em>src_step_y</em>, </td> |
| 175 | </tr> |
| 176 | <tr> |
| 177 | <td class="paramkey"></td> |
| 178 | <td></td> |
| 179 | <td class="paramtype">uint </td> |
| 180 | <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td> |
| 181 | </tr> |
| 182 | <tr> |
| 183 | <td class="paramkey"></td> |
| 184 | <td></td> |
| 185 | <td class="paramtype">__global uchar * </td> |
| 186 | <td class="paramname"><em>dst_ptr</em>, </td> |
| 187 | </tr> |
| 188 | <tr> |
| 189 | <td class="paramkey"></td> |
| 190 | <td></td> |
| 191 | <td class="paramtype">uint </td> |
| 192 | <td class="paramname"><em>dst_stride_x</em>, </td> |
| 193 | </tr> |
| 194 | <tr> |
| 195 | <td class="paramkey"></td> |
| 196 | <td></td> |
| 197 | <td class="paramtype">uint </td> |
| 198 | <td class="paramname"><em>dst_step_x</em>, </td> |
| 199 | </tr> |
| 200 | <tr> |
| 201 | <td class="paramkey"></td> |
| 202 | <td></td> |
| 203 | <td class="paramtype">uint </td> |
| 204 | <td class="paramname"><em>dst_stride_y</em>, </td> |
| 205 | </tr> |
| 206 | <tr> |
| 207 | <td class="paramkey"></td> |
| 208 | <td></td> |
| 209 | <td class="paramtype">uint </td> |
| 210 | <td class="paramname"><em>dst_step_y</em>, </td> |
| 211 | </tr> |
| 212 | <tr> |
| 213 | <td class="paramkey"></td> |
| 214 | <td></td> |
| 215 | <td class="paramtype">uint </td> |
| 216 | <td class="paramname"><em>dst_stride_z</em>, </td> |
| 217 | </tr> |
| 218 | <tr> |
| 219 | <td class="paramkey"></td> |
| 220 | <td></td> |
| 221 | <td class="paramtype">uint </td> |
| 222 | <td class="paramname"><em>dst_step_z</em>, </td> |
| 223 | </tr> |
| 224 | <tr> |
| 225 | <td class="paramkey"></td> |
| 226 | <td></td> |
| 227 | <td class="paramtype">uint </td> |
| 228 | <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td> |
| 229 | </tr> |
| 230 | <tr> |
| 231 | <td class="paramkey"></td> |
| 232 | <td></td> |
| 233 | <td class="paramtype">uint </td> |
| 234 | <td class="paramname"><em>width</em> </td> |
| 235 | </tr> |
| 236 | <tr> |
| 237 | <td></td> |
| 238 | <td>)</td> |
| 239 | <td></td><td></td> |
| 240 | </tr> |
| 241 | </table> |
| 242 | </div><div class="memdoc"> |
| 243 | |
| 244 | <p>This kernel performs a reshaping of the output of the convolution layer. </p> |
| 245 | <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> |
| 246 | <dl class="params"><dt>Parameters</dt><dd> |
| 247 | <table class="params"> |
| 248 | <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> |
| 249 | <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> |
| 250 | <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> |
| 251 | <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> |
| 252 | <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> |
| 253 | <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> |
| 254 | <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> |
| 255 | <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> |
| 256 | <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> |
| 257 | <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> |
| 258 | <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> |
| 259 | <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> |
| 260 | <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> |
| 261 | <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> |
| 262 | <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The output tensor width </td></tr> |
| 263 | </table> |
| 264 | </dd> |
| 265 | </dl> |
| 266 | |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 267 | <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00187">187</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 268 | |
| 269 | <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> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 270 | <div class="fragment"><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> {</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</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="l00193"></a><span class="lineno"> 193</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="l00194"></a><span class="lineno"> 194</span> </div><div class="line"><a name="l00195"></a><span class="lineno"> 195</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="l00196"></a><span class="lineno"> 196</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="l00197"></a><span class="lineno"> 197</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="l00198"></a><span class="lineno"> 198</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> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 271 | <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> |
| 272 | <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> |
| 273 | <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> |
| 274 | <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> |
| 275 | <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> |
| 276 | <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> |
| 277 | <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> |
| 278 | <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> |
| 279 | <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> |
| 280 | </div><!-- fragment --> |
| 281 | </div> |
| 282 | </div> |
| 283 | <a class="anchor" id="afaddfccc926506181141b2dc86cb73f1"></a> |
| 284 | <div class="memitem"> |
| 285 | <div class="memproto"> |
| 286 | <table class="memname"> |
| 287 | <tr> |
| 288 | <td class="memname">__kernel void im2col_generic </td> |
| 289 | <td>(</td> |
| 290 | <td class="paramtype">__global uchar * </td> |
| 291 | <td class="paramname"><em>src_ptr</em>, </td> |
| 292 | </tr> |
| 293 | <tr> |
| 294 | <td class="paramkey"></td> |
| 295 | <td></td> |
| 296 | <td class="paramtype">uint </td> |
| 297 | <td class="paramname"><em>src_stride_x</em>, </td> |
| 298 | </tr> |
| 299 | <tr> |
| 300 | <td class="paramkey"></td> |
| 301 | <td></td> |
| 302 | <td class="paramtype">uint </td> |
| 303 | <td class="paramname"><em>src_step_x</em>, </td> |
| 304 | </tr> |
| 305 | <tr> |
| 306 | <td class="paramkey"></td> |
| 307 | <td></td> |
| 308 | <td class="paramtype">uint </td> |
| 309 | <td class="paramname"><em>src_stride_y</em>, </td> |
| 310 | </tr> |
| 311 | <tr> |
| 312 | <td class="paramkey"></td> |
| 313 | <td></td> |
| 314 | <td class="paramtype">uint </td> |
| 315 | <td class="paramname"><em>src_step_y</em>, </td> |
| 316 | </tr> |
| 317 | <tr> |
| 318 | <td class="paramkey"></td> |
| 319 | <td></td> |
| 320 | <td class="paramtype">uint </td> |
| 321 | <td class="paramname"><em>src_stride_z</em>, </td> |
| 322 | </tr> |
| 323 | <tr> |
| 324 | <td class="paramkey"></td> |
| 325 | <td></td> |
| 326 | <td class="paramtype">uint </td> |
| 327 | <td class="paramname"><em>src_step_z</em>, </td> |
| 328 | </tr> |
| 329 | <tr> |
| 330 | <td class="paramkey"></td> |
| 331 | <td></td> |
| 332 | <td class="paramtype">uint </td> |
| 333 | <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td> |
| 334 | </tr> |
| 335 | <tr> |
| 336 | <td class="paramkey"></td> |
| 337 | <td></td> |
| 338 | <td class="paramtype">__global uchar * </td> |
| 339 | <td class="paramname"><em>dst_ptr</em>, </td> |
| 340 | </tr> |
| 341 | <tr> |
| 342 | <td class="paramkey"></td> |
| 343 | <td></td> |
| 344 | <td class="paramtype">uint </td> |
| 345 | <td class="paramname"><em>dst_stride_x</em>, </td> |
| 346 | </tr> |
| 347 | <tr> |
| 348 | <td class="paramkey"></td> |
| 349 | <td></td> |
| 350 | <td class="paramtype">uint </td> |
| 351 | <td class="paramname"><em>dst_step_x</em>, </td> |
| 352 | </tr> |
| 353 | <tr> |
| 354 | <td class="paramkey"></td> |
| 355 | <td></td> |
| 356 | <td class="paramtype">uint </td> |
| 357 | <td class="paramname"><em>dst_stride_y</em>, </td> |
| 358 | </tr> |
| 359 | <tr> |
| 360 | <td class="paramkey"></td> |
| 361 | <td></td> |
| 362 | <td class="paramtype">uint </td> |
| 363 | <td class="paramname"><em>dst_step_y</em>, </td> |
| 364 | </tr> |
| 365 | <tr> |
| 366 | <td class="paramkey"></td> |
| 367 | <td></td> |
| 368 | <td class="paramtype">uint </td> |
| 369 | <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td> |
| 370 | </tr> |
| 371 | <tr> |
| 372 | <td class="paramkey"></td> |
| 373 | <td></td> |
| 374 | <td class="paramtype">int </td> |
| 375 | <td class="paramname"><em>kernel_size</em>, </td> |
| 376 | </tr> |
| 377 | <tr> |
| 378 | <td class="paramkey"></td> |
| 379 | <td></td> |
| 380 | <td class="paramtype">int </td> |
| 381 | <td class="paramname"><em>kernel_depth</em>, </td> |
| 382 | </tr> |
| 383 | <tr> |
| 384 | <td class="paramkey"></td> |
| 385 | <td></td> |
| 386 | <td class="paramtype">int </td> |
| 387 | <td class="paramname"><em>width</em>, </td> |
| 388 | </tr> |
| 389 | <tr> |
| 390 | <td class="paramkey"></td> |
| 391 | <td></td> |
| 392 | <td class="paramtype">int2 </td> |
| 393 | <td class="paramname"><em>input_dims</em>, </td> |
| 394 | </tr> |
| 395 | <tr> |
| 396 | <td class="paramkey"></td> |
| 397 | <td></td> |
| 398 | <td class="paramtype">int2 </td> |
| 399 | <td class="paramname"><em>strides</em>, </td> |
| 400 | </tr> |
| 401 | <tr> |
| 402 | <td class="paramkey"></td> |
| 403 | <td></td> |
| 404 | <td class="paramtype">int2 </td> |
| 405 | <td class="paramname"><em>paddings</em> </td> |
| 406 | </tr> |
| 407 | <tr> |
| 408 | <td></td> |
| 409 | <td>)</td> |
| 410 | <td></td><td></td> |
| 411 | </tr> |
| 412 | </table> |
| 413 | </div><div class="memdoc"> |
| 414 | |
| 415 | <p>This kernel performs a reshaping of the input tensor to a tensor used to perform convolution using GEMM. </p> |
| 416 | <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 | <dd> |
| 418 | 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> |
| 419 | <dl class="params"><dt>Parameters</dt><dd> |
| 420 | <table class="params"> |
| 421 | <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> |
| 422 | <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> |
| 423 | <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> |
| 424 | <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> |
| 425 | <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> |
| 426 | <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> |
| 427 | <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> |
| 428 | <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> |
| 429 | <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> |
| 430 | <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> |
| 431 | <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> |
| 432 | <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> |
| 433 | <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> |
| 434 | <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> |
| 435 | <tr><td class="paramdir">[in]</td><td class="paramname">kernel_size</td><td>The convolution kernel size </td></tr> |
| 436 | <tr><td class="paramdir">[in]</td><td class="paramname">kernel_depth</td><td>The kernel depth </td></tr> |
| 437 | <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The output tensor width </td></tr> |
| 438 | <tr><td class="paramdir">[in]</td><td class="paramname">input_dims</td><td>The input tensor dimensions </td></tr> |
| 439 | <tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>The strides of the im2col operation </td></tr> |
| 440 | <tr><td class="paramdir">[in]</td><td class="paramname">paddings</td><td>The input tensor paddings </td></tr> |
| 441 | </table> |
| 442 | </dd> |
| 443 | </dl> |
| 444 | |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 445 | <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00122">122</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 446 | |
| 447 | <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> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 448 | <div class="fragment"><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>  <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="l00133"></a><span class="lineno"> 133</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="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="comment">// Determine output index</span></div><div class="line"><a name="l00136"></a><span class="lineno"> 136</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="l00137"></a><span class="lineno"> 137</span>  __global uchar *output_ptr = dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> + idx;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="comment">// Determine current input index</span></div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> top_left_x = get_global_id(0) * strides.x - paddings.x;</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> top_left_y = get_global_id(1) * strides.y - paddings.y;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="comment">// Linearize convolution elements</span></div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> d = 0; d < kernel_depth; ++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>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y = top_left_y, y_e = top_left_y + kernel_size; y < y_e; ++y)</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>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x = top_left_x, x_e = top_left_x + kernel_size; x < x_e; ++x, output_ptr += dst.<a class="code" href="struct_image.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">stride_x</a>)</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="keywordflow">if</span>(x < 0 || x >= input_dims.x || y < 0 || y >= input_dims.y)</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  {</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)output_ptr) = 0;</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  }</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  {</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)output_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, x, y, d)));</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  }</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  }</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  }</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> </div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)output_ptr) = 1;</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00165"></a><span class="lineno"> 165</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> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 449 | <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> |
| 450 | <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> |
| 451 | <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> |
| 452 | <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> |
| 453 | <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> |
| 454 | <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> |
| 455 | <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> |
| 456 | <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> |
| 457 | </div><!-- fragment --> |
| 458 | </div> |
| 459 | </div> |
| 460 | <a class="anchor" id="a6f31f2c8d606e1b57d9bdfacd416024c"></a> |
| 461 | <div class="memitem"> |
| 462 | <div class="memproto"> |
| 463 | <table class="memname"> |
| 464 | <tr> |
| 465 | <td class="memname">__kernel void im2col_reduced </td> |
| 466 | <td>(</td> |
| 467 | <td class="paramtype">__global uchar * </td> |
| 468 | <td class="paramname"><em>src_ptr</em>, </td> |
| 469 | </tr> |
| 470 | <tr> |
| 471 | <td class="paramkey"></td> |
| 472 | <td></td> |
| 473 | <td class="paramtype">uint </td> |
| 474 | <td class="paramname"><em>src_stride_x</em>, </td> |
| 475 | </tr> |
| 476 | <tr> |
| 477 | <td class="paramkey"></td> |
| 478 | <td></td> |
| 479 | <td class="paramtype">uint </td> |
| 480 | <td class="paramname"><em>src_step_x</em>, </td> |
| 481 | </tr> |
| 482 | <tr> |
| 483 | <td class="paramkey"></td> |
| 484 | <td></td> |
| 485 | <td class="paramtype">uint </td> |
| 486 | <td class="paramname"><em>src_stride_y</em>, </td> |
| 487 | </tr> |
| 488 | <tr> |
| 489 | <td class="paramkey"></td> |
| 490 | <td></td> |
| 491 | <td class="paramtype">uint </td> |
| 492 | <td class="paramname"><em>src_step_y</em>, </td> |
| 493 | </tr> |
| 494 | <tr> |
| 495 | <td class="paramkey"></td> |
| 496 | <td></td> |
| 497 | <td class="paramtype">uint </td> |
| 498 | <td class="paramname"><em>src_stride_z</em>, </td> |
| 499 | </tr> |
| 500 | <tr> |
| 501 | <td class="paramkey"></td> |
| 502 | <td></td> |
| 503 | <td class="paramtype">uint </td> |
| 504 | <td class="paramname"><em>src_step_z</em>, </td> |
| 505 | </tr> |
| 506 | <tr> |
| 507 | <td class="paramkey"></td> |
| 508 | <td></td> |
| 509 | <td class="paramtype">uint </td> |
| 510 | <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td> |
| 511 | </tr> |
| 512 | <tr> |
| 513 | <td class="paramkey"></td> |
| 514 | <td></td> |
| 515 | <td class="paramtype">__global uchar * </td> |
| 516 | <td class="paramname"><em>dst_ptr</em>, </td> |
| 517 | </tr> |
| 518 | <tr> |
| 519 | <td class="paramkey"></td> |
| 520 | <td></td> |
| 521 | <td class="paramtype">uint </td> |
| 522 | <td class="paramname"><em>dst_stride_x</em>, </td> |
| 523 | </tr> |
| 524 | <tr> |
| 525 | <td class="paramkey"></td> |
| 526 | <td></td> |
| 527 | <td class="paramtype">uint </td> |
| 528 | <td class="paramname"><em>dst_step_x</em>, </td> |
| 529 | </tr> |
| 530 | <tr> |
| 531 | <td class="paramkey"></td> |
| 532 | <td></td> |
| 533 | <td class="paramtype">uint </td> |
| 534 | <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td> |
| 535 | </tr> |
| 536 | <tr> |
| 537 | <td class="paramkey"></td> |
| 538 | <td></td> |
| 539 | <td class="paramtype">uint </td> |
| 540 | <td class="paramname"><em>width</em>, </td> |
| 541 | </tr> |
| 542 | <tr> |
| 543 | <td class="paramkey"></td> |
| 544 | <td></td> |
| 545 | <td class="paramtype">uint </td> |
| 546 | <td class="paramname"><em>height</em> </td> |
| 547 | </tr> |
| 548 | <tr> |
| 549 | <td></td> |
| 550 | <td>)</td> |
| 551 | <td></td><td></td> |
| 552 | </tr> |
| 553 | </table> |
| 554 | </div><div class="memdoc"> |
| 555 | |
| 556 | <p>This kernel reshapes the tensor's low three dimensions to single row for GEMM operation. </p> |
| 557 | <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 | <dd> |
| 559 | 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> |
| 560 | <dl class="params"><dt>Parameters</dt><dd> |
| 561 | <table class="params"> |
| 562 | <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> |
| 563 | <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> |
| 564 | <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> |
| 565 | <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> |
| 566 | <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> |
| 567 | <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> |
| 568 | <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> |
| 569 | <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> |
| 570 | <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Same as input. </td></tr> |
| 571 | <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> |
| 572 | <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> |
| 573 | <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> |
| 574 | <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the input tensor </td></tr> |
| 575 | <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the input tensor </td></tr> |
| 576 | </table> |
| 577 | </dd> |
| 578 | </dl> |
| 579 | |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 580 | <p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00220">220</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 581 | |
| 582 | <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> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 583 | <div class="fragment"><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>  <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="l00226"></a><span class="lineno"> 226</span> </div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="keyword">const</span> uint image_size = width * height;</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span> </div><div class="line"><a name="l00229"></a><span class="lineno"> 229</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="l00230"></a><span class="lineno"> 230</span> </div><div class="line"><a name="l00231"></a><span class="lineno"> 231</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="l00232"></a><span class="lineno"> 232</span> </div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="comment">// If it is the last thread in the 3 dimensional workgroup</span></div><div class="line"><a name="l00235"></a><span class="lineno"> 235</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="l00236"></a><span class="lineno"> 236</span>  {</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  tmp_out_ptr += dst_stride_x;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</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="l00239"></a><span class="lineno"> 239</span>  }</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00241"></a><span class="lineno"> 241</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> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 584 | <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> |
| 585 | <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> |
| 586 | </div><!-- fragment --> |
| 587 | </div> |
| 588 | </div> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 589 | <a class="anchor" id="ab6358b28d1e7bc946950075d94412013"></a> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 590 | <div class="memitem"> |
| 591 | <div class="memproto"> |
| 592 | <table class="memname"> |
| 593 | <tr> |
| 594 | <td class="memname">__kernel void reshape_to_columns </td> |
| 595 | <td>(</td> |
| 596 | <td class="paramtype">__global uchar * </td> |
| 597 | <td class="paramname"><em>src_ptr</em>, </td> |
| 598 | </tr> |
| 599 | <tr> |
| 600 | <td class="paramkey"></td> |
| 601 | <td></td> |
| 602 | <td class="paramtype">uint </td> |
| 603 | <td class="paramname"><em>src_stride_x</em>, </td> |
| 604 | </tr> |
| 605 | <tr> |
| 606 | <td class="paramkey"></td> |
| 607 | <td></td> |
| 608 | <td class="paramtype">uint </td> |
| 609 | <td class="paramname"><em>src_step_x</em>, </td> |
| 610 | </tr> |
| 611 | <tr> |
| 612 | <td class="paramkey"></td> |
| 613 | <td></td> |
| 614 | <td class="paramtype">uint </td> |
| 615 | <td class="paramname"><em>src_stride_y</em>, </td> |
| 616 | </tr> |
| 617 | <tr> |
| 618 | <td class="paramkey"></td> |
| 619 | <td></td> |
| 620 | <td class="paramtype">uint </td> |
| 621 | <td class="paramname"><em>src_step_y</em>, </td> |
| 622 | </tr> |
| 623 | <tr> |
| 624 | <td class="paramkey"></td> |
| 625 | <td></td> |
| 626 | <td class="paramtype">uint </td> |
| 627 | <td class="paramname"><em>src_stride_z</em>, </td> |
| 628 | </tr> |
| 629 | <tr> |
| 630 | <td class="paramkey"></td> |
| 631 | <td></td> |
| 632 | <td class="paramtype">uint </td> |
| 633 | <td class="paramname"><em>src_step_z</em>, </td> |
| 634 | </tr> |
| 635 | <tr> |
| 636 | <td class="paramkey"></td> |
| 637 | <td></td> |
| 638 | <td class="paramtype">uint </td> |
| 639 | <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td> |
| 640 | </tr> |
| 641 | <tr> |
| 642 | <td class="paramkey"></td> |
| 643 | <td></td> |
| 644 | <td class="paramtype">__global uchar * </td> |
| 645 | <td class="paramname"><em>dst_ptr</em>, </td> |
| 646 | </tr> |
| 647 | <tr> |
| 648 | <td class="paramkey"></td> |
| 649 | <td></td> |
| 650 | <td class="paramtype">uint </td> |
| 651 | <td class="paramname"><em>dst_stride_x</em>, </td> |
| 652 | </tr> |
| 653 | <tr> |
| 654 | <td class="paramkey"></td> |
| 655 | <td></td> |
| 656 | <td class="paramtype">uint </td> |
| 657 | <td class="paramname"><em>dst_step_x</em>, </td> |
| 658 | </tr> |
| 659 | <tr> |
| 660 | <td class="paramkey"></td> |
| 661 | <td></td> |
| 662 | <td class="paramtype">uint </td> |
| 663 | <td class="paramname"><em>dst_stride_y</em>, </td> |
| 664 | </tr> |
| 665 | <tr> |
| 666 | <td class="paramkey"></td> |
| 667 | <td></td> |
| 668 | <td class="paramtype">uint </td> |
| 669 | <td class="paramname"><em>dst_step_y</em>, </td> |
| 670 | </tr> |
| 671 | <tr> |
| 672 | <td class="paramkey"></td> |
| 673 | <td></td> |
| 674 | <td class="paramtype">uint </td> |
| 675 | <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td> |
| 676 | </tr> |
| 677 | <tr> |
| 678 | <td class="paramkey"></td> |
| 679 | <td></td> |
| 680 | <td class="paramtype">__global uchar * </td> |
| 681 | <td class="paramname"><em>bias_ptr</em>, </td> |
| 682 | </tr> |
| 683 | <tr> |
| 684 | <td class="paramkey"></td> |
| 685 | <td></td> |
| 686 | <td class="paramtype">uint </td> |
| 687 | <td class="paramname"><em>bias_stride_x</em>, </td> |
| 688 | </tr> |
| 689 | <tr> |
| 690 | <td class="paramkey"></td> |
| 691 | <td></td> |
| 692 | <td class="paramtype">uint </td> |
| 693 | <td class="paramname"><em>bias_step_x</em>, </td> |
| 694 | </tr> |
| 695 | <tr> |
| 696 | <td class="paramkey"></td> |
| 697 | <td></td> |
| 698 | <td class="paramtype">uint </td> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 699 | <td class="paramname"><em>bias_offset_first_element_in_bytes</em>, </td> |
| 700 | </tr> |
| 701 | <tr> |
| 702 | <td class="paramkey"></td> |
| 703 | <td></td> |
| 704 | <td class="paramtype">uint </td> |
| 705 | <td class="paramname"><em>width</em>, </td> |
| 706 | </tr> |
| 707 | <tr> |
| 708 | <td class="paramkey"></td> |
| 709 | <td></td> |
| 710 | <td class="paramtype">uint </td> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 711 | <td class="paramname"><em>height</em>, </td> |
| 712 | </tr> |
| 713 | <tr> |
| 714 | <td class="paramkey"></td> |
| 715 | <td></td> |
| 716 | <td class="paramtype">uint </td> |
| 717 | <td class="paramname"><em>depth</em>, </td> |
| 718 | </tr> |
| 719 | <tr> |
| 720 | <td class="paramkey"></td> |
| 721 | <td></td> |
| 722 | <td class="paramtype">uint </td> |
| 723 | <td class="paramname"><em>total_filters</em> </td> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 724 | </tr> |
| 725 | <tr> |
| 726 | <td></td> |
| 727 | <td>)</td> |
| 728 | <td></td><td></td> |
| 729 | </tr> |
| 730 | </table> |
| 731 | </div><div class="memdoc"> |
| 732 | |
| 733 | <p>This kernel reshapes the tensor's low three dimensions to single column. </p> |
| 734 | <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> |
| 735 | <dl class="params"><dt>Parameters</dt><dd> |
| 736 | <table class="params"> |
| 737 | <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> |
| 738 | <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> |
| 739 | <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> |
| 740 | <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> |
| 741 | <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> |
| 742 | <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> |
| 743 | <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> |
| 744 | <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> |
| 745 | <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Same as input </td></tr> |
| 746 | <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> |
| 747 | <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> |
| 748 | <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> |
| 749 | <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> |
| 750 | <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> |
| 751 | <tr><td class="paramdir">[in]</td><td class="paramname">bias_ptr</td><td>Pointer to the bias tensor. Same as input </td></tr> |
| 752 | <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> |
| 753 | <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> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 754 | <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> |
| 755 | <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the input tensor </td></tr> |
| 756 | <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the input tensor </td></tr> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 757 | <tr><td class="paramdir">[in]</td><td class="paramname">depth</td><td>The depth of the input tensor </td></tr> |
| 758 | <tr><td class="paramdir">[in]</td><td class="paramname">total_filters</td><td>Total number of filters. 4th dimension of the weights matrix </td></tr> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 759 | </table> |
| 760 | </dd> |
| 761 | </dl> |
| 762 | |
| 763 | <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 | |
| 765 | <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> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 766 | <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>  <span class="keywordtype">bool</span> is_last_thread = (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="l00063"></a><span class="lineno"> 63</span> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  __global uchar *tmp_src_ptr = src.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  __global uchar *tmp_dst_ptr = dst_ptr + dst_offset_first_element_in_bytes + get_global_id(0) * dst_stride_y + get_global_id(1) * width * dst_stride_y + get_global_id(</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  2) * width * height * dst_stride_y;</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  __global uchar *tmp_bias_ptr = bias_ptr + bias_offset_first_element_in_bytes;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">if</span>(is_last_thread)</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  {</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">for</span>(uint i = 0; i < total_filters; ++i)</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>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_dst_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_src_ptr);</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="preprocessor">#if defined HAS_BIAS</span></div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(tmp_dst_ptr + dst_stride_y)) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(tmp_bias_ptr));</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  tmp_bias_ptr += bias_stride_x;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  tmp_src_ptr += depth * src_stride_z;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  tmp_dst_ptr += dst_stride_x;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  }</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  {</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordflow">for</span>(uint i = 0; i < total_filters; ++i)</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  {</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_dst_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_src_ptr);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  tmp_src_ptr += depth * src_stride_z;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  tmp_dst_ptr += dst_stride_x;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  }</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</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> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 767 | <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> |
| 768 | <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> |
| 769 | <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> |
| 770 | </div><!-- fragment --> |
| 771 | </div> |
| 772 | </div> |
| 773 | </div><!-- contents --> |
| 774 | </div><!-- doc-content --> |
| 775 | <!-- start footer part --> |
| 776 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 777 | <ul> |
| 778 | <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> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 779 | <li class="footer">Generated on Fri Jun 23 2017 15:44:34 for Compute Library by |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 780 | <a href="http://www.doxygen.org/index.html"> |
| 781 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li> |
| 782 | </ul> |
| 783 | </div> |
| 784 | </body> |
| 785 | </html> |