blob: 42622c51160f06bdcf5be10b8ddda05b17b35095 [file] [log] [blame]
<!-- HTML header for doxygen 1.8.15-->
<!-- Remember to use version doxygen 1.8.15 +-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
<title>Compute Library: arm_compute::helpers::tensor_transform Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<img alt="Compute Library" src="https://raw.githubusercontent.com/ARM-software/ComputeLibrary/gh-pages/ACL_logo.png" style="max-width: 100%;margin-top: 15px;margin-left: 10px"/>
<td style="padding-left: 0.5em;">
<div id="projectname">
&#160;<span id="projectnumber">19.08</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">arm_compute::helpers::tensor_transform Namespace Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a9e3d9626e902ce6f9555d3580e13011e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">calculate_stride_on_index</a> (int index, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> strides)</td></tr>
<tr class="memdesc:a9e3d9626e902ce6f9555d3580e13011e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes stride of a given index. <a href="#a9e3d9626e902ce6f9555d3580e13011e">More...</a><br /></td></tr>
<tr class="separator:a9e3d9626e902ce6f9555d3580e13011e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ff938cc9ead3acbbb2eb10d09d9c457"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a3ff938cc9ead3acbbb2eb10d09d9c457">calculate_start_on_index</a> (<a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> input_shape, int index, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> starts, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> strides, int32_t begin_mask)</td></tr>
<tr class="memdesc:a3ff938cc9ead3acbbb2eb10d09d9c457"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes absolute start position of a given index for a strided slice operation. <a href="#a3ff938cc9ead3acbbb2eb10d09d9c457">More...</a><br /></td></tr>
<tr class="separator:a3ff938cc9ead3acbbb2eb10d09d9c457"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aadc7bc8c8e64fd06504c35173c88f7d1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#aadc7bc8c8e64fd06504c35173c88f7d1">calculate_end_on_index</a> (<a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> input_shape, int index, int start_on_index, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> ends, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> strides, int32_t end_mask=0, int32_t shrink_axis_mask=0)</td></tr>
<tr class="memdesc:aadc7bc8c8e64fd06504c35173c88f7d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the absolute end position of a given index for a strided slice operation. <a href="#aadc7bc8c8e64fd06504c35173c88f7d1">More...</a><br /></td></tr>
<tr class="separator:aadc7bc8c8e64fd06504c35173c88f7d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6a03e096e644bb85ed26acafd1516339"><td class="memItemLeft" align="right" valign="top">std::tuple&lt; <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a6a03e096e644bb85ed26acafd1516339">calculate_strided_slice_coords</a> (<a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> input_shape, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> starts, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> ends, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> strides, int32_t begin_mask=0, int32_t end_mask=0, int32_t shrink_axis_mask=0)</td></tr>
<tr class="memdesc:a6a03e096e644bb85ed26acafd1516339"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate start, end and stride coordinates for a strided slice. <a href="#a6a03e096e644bb85ed26acafd1516339">More...</a><br /></td></tr>
<tr class="separator:a6a03e096e644bb85ed26acafd1516339"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adb1ed814b11a751017250143fb1a9174"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#adb1ed814b11a751017250143fb1a9174">compute_strided_slice_output_shape</a> (<a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> input_shape, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> starts, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> ends, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> strides, int32_t begin_mask=0, int32_t end_mask=0, int32_t shrink_axis_mask=0, bool return_unshrinked=false)</td></tr>
<tr class="memdesc:adb1ed814b11a751017250143fb1a9174"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes output shape of strided slice. <a href="#adb1ed814b11a751017250143fb1a9174">More...</a><br /></td></tr>
<tr class="separator:adb1ed814b11a751017250143fb1a9174"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a396d80389277ad8cd13a5e0567776191"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a396d80389277ad8cd13a5e0567776191">construct_slice_end_mask</a> (<a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> ends)</td></tr>
<tr class="memdesc:a396d80389277ad8cd13a5e0567776191"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs end mask in case we want to perform a slice operation using the strided slice interface. <a href="#a396d80389277ad8cd13a5e0567776191">More...</a><br /></td></tr>
<tr class="separator:a396d80389277ad8cd13a5e0567776191"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="aadc7bc8c8e64fd06504c35173c88f7d1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aadc7bc8c8e64fd06504c35173c88f7d1">&#9670;&nbsp;</a></span>calculate_end_on_index()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int calculate_end_on_index </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a>&#160;</td>
<td class="paramname"><em>input_shape</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>start_on_index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>ends</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>strides</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>end_mask</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>shrink_axis_mask</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the absolute end position of a given index for a strided slice operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">input_shape</td><td>Input tensor shape </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>Index of tensor to calculate absolute start position </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">start_on_index</td><td>Absolute start coordinate for given index </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ends</td><td>End coordinates </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>Slice strides </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">end_mask</td><td>(Optional) If the ith bit of end_mask is set, end[i] is ignored and the fullest possible range in that dimension is used instead. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">shrink_axis_mask</td><td>(Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. A slice of size 1 starting from starts[i] in the dimension must be preserved.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Absolute end position of a given index </dd></dl>
<p class="definition">Definition at line <a class="el" href="tensor__transform_8cpp_source.xhtml#l00072">72</a> of file <a class="el" href="tensor__transform_8cpp_source.xhtml">tensor_transform.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;{</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="comment">// Early exit</span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordflow">if</span>(index &gt;= static_cast&lt;int&gt;(ends.num_dimensions()))</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; {</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>[index];</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; }</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> stride = <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">calculate_stride_on_index</a>(index, strides);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keyword">const</span> <span class="keywordtype">bool</span> shrink_axis = <a class="code" href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a>(shrink_axis_mask, index);</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="comment">// Calculate start</span></div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <span class="keywordtype">int</span> stop = ends[index];</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="comment">// Shrink dimension</span></div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <span class="keywordflow">if</span>(shrink_axis)</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; {</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; stop = start_on_index + 1;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; <span class="comment">// Reset in case of begin mask present</span></div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a>(end_mask, index) &amp;&amp; !shrink_axis)</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; {</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; stop = (stride &gt; 0) ? std::numeric_limits&lt;int&gt;::max() : <a class="code" href="namespacearm__compute_1_1support_1_1cpp11.xhtml#a73e352c61baaf9c1178da2d30105b04e">std::numeric_limits&lt;int&gt;::lowest</a>();</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; }</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="comment">// Account negative end points</span></div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> dim_size = <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>[index];</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordflow">if</span>(stop &lt; 0)</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; {</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; stop += dim_size;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; }</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="comment">// Final clamp</span></div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; stop = (stride &gt; 0) ? <a class="code" href="namespacearm__compute_1_1utility.xhtml#a96efecf997f13a914609ddf1eb67f624">utility::clamp</a>(stop, 0, dim_size) : <a class="code" href="namespacearm__compute_1_1utility.xhtml#a96efecf997f13a914609ddf1eb67f624">utility::clamp</a>(stop, -1, dim_size - 1);</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="keywordflow">return</span> stop;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;}</div><div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_a9e3d9626e902ce6f9555d3580e13011e"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">arm_compute::helpers::tensor_transform::calculate_stride_on_index</a></div><div class="ttdeci">int calculate_stride_on_index(int index, Coordinates strides)</div><div class="ttdoc">Computes stride of a given index.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00034">tensor_transform.cpp:34</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1bit__ops_xhtml_a54d65336303dbf657a5e954f72b37941"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a></div><div class="ttdeci">bool is_bit_set(T v, unsigned int idx)</div><div class="ttdoc">Checks if the idx-th bit is set in an integral type.</div><div class="ttdef"><b>Definition:</b> <a href="bit__ops_8h_source.xhtml#l00045">bit_ops.h:45</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a865514e30baa11b11c8fa65f944532fb"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">arm_compute::test::validation::input_shape</a></div><div class="ttdeci">input_shape</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">ConvolutionLayer.cpp:174</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1support_1_1cpp11_xhtml_a73e352c61baaf9c1178da2d30105b04e"><div class="ttname"><a href="namespacearm__compute_1_1support_1_1cpp11.xhtml#a73e352c61baaf9c1178da2d30105b04e">arm_compute::support::cpp11::lowest</a></div><div class="ttdeci">T lowest()</div><div class="ttdef"><b>Definition:</b> <a href="_toolchain_support_8h_source.xhtml#l00384">ToolchainSupport.h:384</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1utility_xhtml_a96efecf997f13a914609ddf1eb67f624"><div class="ttname"><a href="namespacearm__compute_1_1utility.xhtml#a96efecf997f13a914609ddf1eb67f624">arm_compute::utility::clamp</a></div><div class="ttdeci">DataType clamp(const DataType &amp;n, const DataType &amp;lower=std::numeric_limits&lt; RangeType &gt;::lowest(), const DataType &amp;upper=std::numeric_limits&lt; RangeType &gt;::max())</div><div class="ttdoc">Performs clamping among a lower and upper value.</div><div class="ttdef"><b>Definition:</b> <a href="_utility_8h_source.xhtml#l00084">Utility.h:84</a></div></div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="tensor__transform_8cpp_source.xhtml#l00034">calculate_stride_on_index()</a>, <a class="el" href="_utility_8h_source.xhtml#l00084">arm_compute::utility::clamp()</a>, <a class="el" href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">arm_compute::test::validation::input_shape</a>, <a class="el" href="bit__ops_8h_source.xhtml#l00045">arm_compute::helpers::bit_ops::is_bit_set()</a>, <a class="el" href="_toolchain_support_8h_source.xhtml#l00384">arm_compute::support::cpp11::lowest()</a>, and <a class="el" href="_dimensions_8h_source.xhtml#l00122">Dimensions&lt; T &gt;::num_dimensions()</a>.</p>
<p class="reference">Referenced by <a class="el" href="tensor__transform_8cpp_source.xhtml#l00113">calculate_strided_slice_coords()</a>, and <a class="el" href="tensor__transform_8cpp_source.xhtml#l00132">compute_strided_slice_output_shape()</a>.</p>
</div>
</div>
<a id="a3ff938cc9ead3acbbb2eb10d09d9c457"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ff938cc9ead3acbbb2eb10d09d9c457">&#9670;&nbsp;</a></span>calculate_start_on_index()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int calculate_start_on_index </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a>&#160;</td>
<td class="paramname"><em>input_shape</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>starts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>strides</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>begin_mask</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes absolute start position of a given index for a strided slice operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">input_shape</td><td>Input tensor shape </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>Index of tensor to calculate absolute start position </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">starts</td><td>Start coordinates </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>Slice strides </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">begin_mask</td><td>(Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Absolute start position of a given index </dd></dl>
<p class="definition">Definition at line <a class="el" href="tensor__transform_8cpp_source.xhtml#l00039">39</a> of file <a class="el" href="tensor__transform_8cpp_source.xhtml">tensor_transform.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;{</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="comment">// Early exit</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">if</span>(index &gt;= static_cast&lt;int&gt;(starts.num_dimensions()))</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; {</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; }</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="comment">// Get stride</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> stride = <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">calculate_stride_on_index</a>(index, strides);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="comment">// Calculate start</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <span class="keywordtype">int</span> start = starts[index];</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="comment">// Reset in case of begin mask present</span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a>(begin_mask, index))</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; start = stride &gt; 0 ? <a class="code" href="namespacearm__compute_1_1support_1_1cpp11.xhtml#a73e352c61baaf9c1178da2d30105b04e">std::numeric_limits&lt;int&gt;::lowest</a>() : std::numeric_limits&lt;int&gt;::max();</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; }</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="comment">// Account negative start points</span></div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> dim_size = <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>[index];</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keywordflow">if</span>(start &lt; 0)</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; {</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; start += dim_size;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; }</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="comment">// Final clamp</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; start = <a class="code" href="namespacearm__compute_1_1utility.xhtml#a96efecf997f13a914609ddf1eb67f624">utility::clamp</a>(start, 0, dim_size - 1);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="keywordflow">return</span> start;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;}</div><div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_a9e3d9626e902ce6f9555d3580e13011e"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">arm_compute::helpers::tensor_transform::calculate_stride_on_index</a></div><div class="ttdeci">int calculate_stride_on_index(int index, Coordinates strides)</div><div class="ttdoc">Computes stride of a given index.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00034">tensor_transform.cpp:34</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1bit__ops_xhtml_a54d65336303dbf657a5e954f72b37941"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a></div><div class="ttdeci">bool is_bit_set(T v, unsigned int idx)</div><div class="ttdoc">Checks if the idx-th bit is set in an integral type.</div><div class="ttdef"><b>Definition:</b> <a href="bit__ops_8h_source.xhtml#l00045">bit_ops.h:45</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a865514e30baa11b11c8fa65f944532fb"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">arm_compute::test::validation::input_shape</a></div><div class="ttdeci">input_shape</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">ConvolutionLayer.cpp:174</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1support_1_1cpp11_xhtml_a73e352c61baaf9c1178da2d30105b04e"><div class="ttname"><a href="namespacearm__compute_1_1support_1_1cpp11.xhtml#a73e352c61baaf9c1178da2d30105b04e">arm_compute::support::cpp11::lowest</a></div><div class="ttdeci">T lowest()</div><div class="ttdef"><b>Definition:</b> <a href="_toolchain_support_8h_source.xhtml#l00384">ToolchainSupport.h:384</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1utility_xhtml_a96efecf997f13a914609ddf1eb67f624"><div class="ttname"><a href="namespacearm__compute_1_1utility.xhtml#a96efecf997f13a914609ddf1eb67f624">arm_compute::utility::clamp</a></div><div class="ttdeci">DataType clamp(const DataType &amp;n, const DataType &amp;lower=std::numeric_limits&lt; RangeType &gt;::lowest(), const DataType &amp;upper=std::numeric_limits&lt; RangeType &gt;::max())</div><div class="ttdoc">Performs clamping among a lower and upper value.</div><div class="ttdef"><b>Definition:</b> <a href="_utility_8h_source.xhtml#l00084">Utility.h:84</a></div></div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="tensor__transform_8cpp_source.xhtml#l00034">calculate_stride_on_index()</a>, <a class="el" href="_utility_8h_source.xhtml#l00084">arm_compute::utility::clamp()</a>, <a class="el" href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">arm_compute::test::validation::input_shape</a>, <a class="el" href="bit__ops_8h_source.xhtml#l00045">arm_compute::helpers::bit_ops::is_bit_set()</a>, <a class="el" href="_toolchain_support_8h_source.xhtml#l00384">arm_compute::support::cpp11::lowest()</a>, and <a class="el" href="_dimensions_8h_source.xhtml#l00122">Dimensions&lt; T &gt;::num_dimensions()</a>.</p>
<p class="reference">Referenced by <a class="el" href="tensor__transform_8cpp_source.xhtml#l00113">calculate_strided_slice_coords()</a>, and <a class="el" href="tensor__transform_8cpp_source.xhtml#l00132">compute_strided_slice_output_shape()</a>.</p>
</div>
</div>
<a id="a9e3d9626e902ce6f9555d3580e13011e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9e3d9626e902ce6f9555d3580e13011e">&#9670;&nbsp;</a></span>calculate_stride_on_index()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int calculate_stride_on_index </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>strides</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes stride of a given index. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>Index of tensor to calculate absolute start position </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>Slice strides</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Stride at a given index </dd></dl>
<p class="definition">Definition at line <a class="el" href="tensor__transform_8cpp_source.xhtml#l00034">34</a> of file <a class="el" href="tensor__transform_8cpp_source.xhtml">tensor_transform.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;{</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordflow">return</span> index &gt;= static_cast&lt;int&gt;(strides.num_dimensions()) ? 1 : strides[index];</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;}</div></div><!-- fragment -->
<p class="reference">References <a class="el" href="_dimensions_8h_source.xhtml#l00122">Dimensions&lt; T &gt;::num_dimensions()</a>.</p>
<p class="reference">Referenced by <a class="el" href="tensor__transform_8cpp_source.xhtml#l00072">calculate_end_on_index()</a>, <a class="el" href="tensor__transform_8cpp_source.xhtml#l00039">calculate_start_on_index()</a>, <a class="el" href="tensor__transform_8cpp_source.xhtml#l00113">calculate_strided_slice_coords()</a>, and <a class="el" href="tensor__transform_8cpp_source.xhtml#l00132">compute_strided_slice_output_shape()</a>.</p>
</div>
</div>
<a id="a6a03e096e644bb85ed26acafd1516339"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6a03e096e644bb85ed26acafd1516339">&#9670;&nbsp;</a></span>calculate_strided_slice_coords()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::tuple&lt; <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>, <a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> &gt; calculate_strided_slice_coords </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a>&#160;</td>
<td class="paramname"><em>input_shape</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>starts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>ends</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>strides</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>begin_mask</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>end_mask</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>shrink_axis_mask</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Calculate start, end and stride coordinates for a strided slice. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">input_shape</td><td>Input tensor shape </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">starts</td><td>Start coordinates </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ends</td><td>End coordinates </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>Slice strides </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">begin_mask</td><td>(Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">end_mask</td><td>(Optional) If the ith bit of end_mask is set, end[i] is ignored and the fullest possible range in that dimension is used instead. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">shrink_axis_mask</td><td>(Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. A slice of size 1 starting from starts[i] in the dimension must be preserved.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A tuple with &lt;Start,End,<a class="el" href="classarm__compute_1_1_strides.xhtml" title="Strides of an item in bytes.">Strides</a>&gt; </dd></dl>
<p class="definition">Definition at line <a class="el" href="tensor__transform_8cpp_source.xhtml#l00113">113</a> of file <a class="el" href="tensor__transform_8cpp_source.xhtml">tensor_transform.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;{</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; Coordinates starts_abs{};</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; Coordinates ends_abs{};</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; Coordinates final_strides{};</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>.num_dimensions(); ++i)</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; {</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> start_i = <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a3ff938cc9ead3acbbb2eb10d09d9c457">calculate_start_on_index</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, i, starts, strides, begin_mask);</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; starts_abs.set(i, start_i);</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; ends_abs.set(i, <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#aadc7bc8c8e64fd06504c35173c88f7d1">calculate_end_on_index</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, i, start_i, ends, strides, end_mask, shrink_axis_mask));</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; final_strides.set(i, <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">calculate_stride_on_index</a>(i, strides));</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; }</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keywordflow">return</span> std::make_tuple(starts_abs, ends_abs, final_strides);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;}</div><div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_a9e3d9626e902ce6f9555d3580e13011e"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">arm_compute::helpers::tensor_transform::calculate_stride_on_index</a></div><div class="ttdeci">int calculate_stride_on_index(int index, Coordinates strides)</div><div class="ttdoc">Computes stride of a given index.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00034">tensor_transform.cpp:34</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a865514e30baa11b11c8fa65f944532fb"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">arm_compute::test::validation::input_shape</a></div><div class="ttdeci">input_shape</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">ConvolutionLayer.cpp:174</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_aadc7bc8c8e64fd06504c35173c88f7d1"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#aadc7bc8c8e64fd06504c35173c88f7d1">arm_compute::helpers::tensor_transform::calculate_end_on_index</a></div><div class="ttdeci">int calculate_end_on_index(TensorShape input_shape, int index, int start_on_index, Coordinates ends, Coordinates strides, int32_t end_mask=0, int32_t shrink_axis_mask=0)</div><div class="ttdoc">Returns the absolute end position of a given index for a strided slice operation.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00072">tensor_transform.cpp:72</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_a3ff938cc9ead3acbbb2eb10d09d9c457"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a3ff938cc9ead3acbbb2eb10d09d9c457">arm_compute::helpers::tensor_transform::calculate_start_on_index</a></div><div class="ttdeci">int calculate_start_on_index(TensorShape input_shape, int index, Coordinates starts, Coordinates strides, int32_t begin_mask)</div><div class="ttdoc">Computes absolute start position of a given index for a strided slice operation.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00039">tensor_transform.cpp:39</a></div></div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="tensor__transform_8cpp_source.xhtml#l00072">calculate_end_on_index()</a>, <a class="el" href="tensor__transform_8cpp_source.xhtml#l00039">calculate_start_on_index()</a>, <a class="el" href="tensor__transform_8cpp_source.xhtml#l00034">calculate_stride_on_index()</a>, and <a class="el" href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">arm_compute::test::validation::input_shape</a>.</p>
<p class="reference">Referenced by <a class="el" href="_c_l_strided_slice_kernel_8cpp_source.xhtml#l00104">CLStridedSliceKernel::configure()</a>, <a class="el" href="_n_e_strided_slice_kernel_8cpp_source.xhtml#l00138">NEStridedSliceKernel::configure()</a>, and <a class="el" href="_slice_operations_8cpp_source.xhtml#l00080">arm_compute::test::validation::reference::strided_slice()</a>.</p>
</div>
</div>
<a id="adb1ed814b11a751017250143fb1a9174"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb1ed814b11a751017250143fb1a9174">&#9670;&nbsp;</a></span>compute_strided_slice_output_shape()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> compute_strided_slice_output_shape </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a>&#160;</td>
<td class="paramname"><em>input_shape</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>starts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>ends</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>strides</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>begin_mask</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>end_mask</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>shrink_axis_mask</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>return_unshrinked</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes output shape of strided slice. </p>
<dl class="section warning"><dt>Warning</dt><dd>Starts and ends must be non-negative </dd>
<dd>
Starts, ends and final strides should have the same dimensions as the input shape</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">input_shape</td><td>Input tensor shape </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">starts</td><td>Absolute start coordinates </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ends</td><td>Absolute end coordinates </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">strides</td><td>Slice strides </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">begin_mask</td><td>(Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">end_mask</td><td>(Optional) If the ith bit of end_mask is set, end[i] is ignored and the fullest possible range in that dimension is used instead. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">shrink_axis_mask</td><td>(Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. A slice of size 1 starting from starts[i] in the dimension must be preserved. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">return_unshrinked</td><td>(Optional) Returns un-shrinked shape</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The output tensor shape </dd></dl>
<p class="definition">Definition at line <a class="el" href="tensor__transform_8cpp_source.xhtml#l00132">132</a> of file <a class="el" href="tensor__transform_8cpp_source.xhtml">tensor_transform.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;{</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; TensorShape <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>.num_dimensions(); ++i)</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> stride = <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">calculate_stride_on_index</a>(index, strides);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> start = <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a3ff938cc9ead3acbbb2eb10d09d9c457">calculate_start_on_index</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, i, starts, strides, begin_mask);</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> end = <a class="code" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#aadc7bc8c8e64fd06504c35173c88f7d1">calculate_end_on_index</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, i, start, ends, strides, end_mask, shrink_axis_mask);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a87f09c74765be18a99038478f96daf9b">range</a> = end - start;</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="keyword">const</span> <span class="keywordtype">bool</span> is_shrink = <a class="code" href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a>(shrink_axis_mask, i);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keywordflow">if</span>(return_unshrinked || !is_shrink)</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; {</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordflow">if</span>((<a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a87f09c74765be18a99038478f96daf9b">range</a> == 0) || <span class="comment">// Zero range</span></div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; (range &lt; 0 &amp;&amp; stride &gt;= 0) || <span class="comment">// Negative range with positive stride</span></div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; (<a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a87f09c74765be18a99038478f96daf9b">range</a> &gt; 0 &amp;&amp; stride &lt;= 0)) <span class="comment">// Positive range with negative stride</span></div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; {</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>.set(index, 0);</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>;</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; }</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <span class="keywordflow">else</span></div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; {</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="keywordtype">int</span> dim = <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a87f09c74765be18a99038478f96daf9b">range</a> / stride + (<a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a87f09c74765be18a99038478f96daf9b">range</a> % stride != 0 ? 1 : 0);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>.set(index++, dim);</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; }</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; }</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160;}</div><div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_a9e3d9626e902ce6f9555d3580e13011e"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a9e3d9626e902ce6f9555d3580e13011e">arm_compute::helpers::tensor_transform::calculate_stride_on_index</a></div><div class="ttdeci">int calculate_stride_on_index(int index, Coordinates strides)</div><div class="ttdoc">Computes stride of a given index.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00034">tensor_transform.cpp:34</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1bit__ops_xhtml_a54d65336303dbf657a5e954f72b37941"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1bit__ops.xhtml#a54d65336303dbf657a5e954f72b37941">arm_compute::helpers::bit_ops::is_bit_set</a></div><div class="ttdeci">bool is_bit_set(T v, unsigned int idx)</div><div class="ttdoc">Checks if the idx-th bit is set in an integral type.</div><div class="ttdef"><b>Definition:</b> <a href="bit__ops_8h_source.xhtml#l00045">bit_ops.h:45</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a865514e30baa11b11c8fa65f944532fb"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">arm_compute::test::validation::input_shape</a></div><div class="ttdeci">input_shape</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">ConvolutionLayer.cpp:174</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_1_1reference_xhtml_a87f09c74765be18a99038478f96daf9b"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a87f09c74765be18a99038478f96daf9b">arm_compute::test::validation::reference::range</a></div><div class="ttdeci">SimpleTensor&lt; T &gt; range(SimpleTensor&lt; T &gt; &amp;dst, float start, const size_t num_of_elements, float step)</div><div class="ttdef"><b>Definition:</b> <a href="reference_2_range_8cpp_source.xhtml#l00050">Range.cpp:50</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a7fc93f37dac131a1a40b7921f9df3a9a"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">arm_compute::test::validation::output_shape</a></div><div class="ttdeci">output_shape</div><div class="ttdef"><b>Definition:</b> <a href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">ConvolutionLayer.cpp:174</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_aadc7bc8c8e64fd06504c35173c88f7d1"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#aadc7bc8c8e64fd06504c35173c88f7d1">arm_compute::helpers::tensor_transform::calculate_end_on_index</a></div><div class="ttdeci">int calculate_end_on_index(TensorShape input_shape, int index, int start_on_index, Coordinates ends, Coordinates strides, int32_t end_mask=0, int32_t shrink_axis_mask=0)</div><div class="ttdoc">Returns the absolute end position of a given index for a strided slice operation.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00072">tensor_transform.cpp:72</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1helpers_1_1tensor__transform_xhtml_a3ff938cc9ead3acbbb2eb10d09d9c457"><div class="ttname"><a href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml#a3ff938cc9ead3acbbb2eb10d09d9c457">arm_compute::helpers::tensor_transform::calculate_start_on_index</a></div><div class="ttdeci">int calculate_start_on_index(TensorShape input_shape, int index, Coordinates starts, Coordinates strides, int32_t begin_mask)</div><div class="ttdoc">Computes absolute start position of a given index for a strided slice operation.</div><div class="ttdef"><b>Definition:</b> <a href="tensor__transform_8cpp_source.xhtml#l00039">tensor_transform.cpp:39</a></div></div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="tensor__transform_8cpp_source.xhtml#l00072">calculate_end_on_index()</a>, <a class="el" href="tensor__transform_8cpp_source.xhtml#l00039">calculate_start_on_index()</a>, <a class="el" href="tensor__transform_8cpp_source.xhtml#l00034">calculate_stride_on_index()</a>, <a class="el" href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">arm_compute::test::validation::input_shape</a>, <a class="el" href="bit__ops_8h_source.xhtml#l00045">arm_compute::helpers::bit_ops::is_bit_set()</a>, <a class="el" href="validation_2_c_l_2_convolution_layer_8cpp_source.xhtml#l00174">arm_compute::test::validation::output_shape</a>, and <a class="el" href="reference_2_range_8cpp_source.xhtml#l00050">arm_compute::test::validation::reference::range()</a>.</p>
<p class="reference">Referenced by <a class="el" href="_shape_calculator_8h_source.xhtml#l00981">arm_compute::misc::shape_calculator::compute_slice_shape()</a>, <a class="el" href="_shape_calculator_8h_source.xhtml#l00965">arm_compute::misc::shape_calculator::compute_strided_slice_shape()</a>, and <a class="el" href="_slice_operations_8cpp_source.xhtml#l00080">arm_compute::test::validation::reference::strided_slice()</a>.</p>
</div>
</div>
<a id="a396d80389277ad8cd13a5e0567776191"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a396d80389277ad8cd13a5e0567776191">&#9670;&nbsp;</a></span>construct_slice_end_mask()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t construct_slice_end_mask </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>&#160;</td>
<td class="paramname"><em>ends</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructs end mask in case we want to perform a slice operation using the strided slice interface. </p>
<dl class="section note"><dt>Note</dt><dd>Ends are inclusive in slice operations that is why construction an end mask is needed</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ends</td><td>End coordinates</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>End mask </dd></dl>
<p class="definition">Definition at line <a class="el" href="tensor__transform_8cpp_source.xhtml#l00165">165</a> of file <a class="el" href="tensor__transform_8cpp_source.xhtml">tensor_transform.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160;{</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="comment">// Create end mask</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; int32_t end_mask = 0;</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; ends.num_dimensions(); ++i)</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; {</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <span class="keywordflow">if</span>(ends[i] &lt; 0)</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; {</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; end_mask |= 1 &lt;&lt; i;</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; }</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; }</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; <span class="keywordflow">return</span> end_mask;</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;}</div></div><!-- fragment -->
<p class="reference">References <a class="el" href="_dimensions_8h_source.xhtml#l00122">Dimensions&lt; T &gt;::num_dimensions()</a>.</p>
<p class="reference">Referenced by <a class="el" href="_shape_calculator_8h_source.xhtml#l00981">arm_compute::misc::shape_calculator::compute_slice_shape()</a>, <a class="el" href="_c_l_slice_8cpp_source.xhtml#l00034">CLSlice::configure()</a>, <a class="el" href="_n_e_slice_8cpp_source.xhtml#l00036">NESlice::configure()</a>, <a class="el" href="_c_l_slice_8cpp_source.xhtml#l00046">CLSlice::validate()</a>, and <a class="el" href="_n_e_slice_8cpp_source.xhtml#l00048">NESlice::validate()</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespacearm__compute.xhtml">arm_compute</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1helpers.xhtml">helpers</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1helpers_1_1tensor__transform.xhtml">tensor_transform</a></li>
<li class="footer">Generated on Mon Sep 2 2019 11:47:40 for Compute Library by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
</ul>
</div>
</body>
</html>