arm_compute v19.05
diff --git a/documentation/add_operator.xhtml b/documentation/add_operator.xhtml
index be279a5..4395a6c 100644
--- a/documentation/add_operator.xhtml
+++ b/documentation/add_operator.xhtml
@@ -40,7 +40,7 @@
<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">
-  <span id="projectnumber">19.02</span>
+  <span id="projectnumber">19.05</span>
</div>
</td>
</tr>
@@ -173,7 +173,7 @@
<li>configure: configure the kernel, its window, accessor, valid region, etc for the given set of tensors and other parameters.</li>
<li>run: execute the kernel in the window</li>
</ul>
-<p>The structure of the kernel .cpp file should be similar to the next ones. For OpenCL: </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespacearm__compute.xhtml">arm_compute</a>;</div><div class="line"></div><div class="line"><span class="keyword">namespace</span></div><div class="line">{</div><div class="line"><a class="code" href="classarm__compute_1_1_status.xhtml">Status</a> validate_arguments(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *input, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_c_l_validate_8h.xhtml#ab82bd5de18ef067ae5d9ba4af8065dd6">ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED</a>(input);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#ae7eed178dac535c6e727061b1f5bc6eb">ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN</a>(input, 1, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">DataType::U8</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6aafb0fced528eaac5fe170b763cda5975">DataType::S8</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6af14462d71aa842202c3e4b272c7ec924">DataType::QASYMM8</a>,</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aef9ef3ebca4d2b64b6ec83808bafa5f2">DataType::U16</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6e0b0886efb94aec797f6b830329b72c">DataType::S16</a>,</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58ac8bd5bedff8ef192d39a962afc0e19ee">DataType::U32</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aa1e28eee0339658d39a8b4d325b56e9c">DataType::S32</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a56d8353718e6fdc78b8d69078a2cdb94">DataType::F16</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">DataType::F32</a>);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#aff911654521523937ff24372a870b89f">ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR</a>(output);</div><div class="line"></div><div class="line"> <a class="code" href="_validate_8h.xhtml#a8f3ff7da485ff7e75dab07baadf5b4bd">ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES</a>(input, output);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#aba910b683652be1f65437ef37a9da2a9">ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO</a>(input, output);</div><div class="line"> <a class="code" href="_error_8h.xhtml#a206d6e247e0957ac3dee45d27756fc25">ARM_COMPUTE_RETURN_ERROR_ON</a>(input-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>().<a class="code" href="classarm__compute_1_1_tensor_shape.xhtml#a0fdcb923dfd4c74858cc2bc326321efb">total_size</a>() != output-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>().<a class="code" href="classarm__compute_1_1_tensor_shape.xhtml#a0fdcb923dfd4c74858cc2bc326321efb">total_size</a>());</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="classarm__compute_1_1_status.xhtml">Status</a>{};</div><div class="line">}</div><div class="line"></div><div class="line">} <span class="comment">// namespace</span></div><div class="line"></div><div class="line"><a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#ab7a7f679ba9f567fbe64ebc2ad4c4324">CLReshapeLayerKernel::CLReshapeLayerKernel</a>()</div><div class="line"> : _input(nullptr), _output(nullptr)</div><div class="line">{</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#a074e10cfb217e657b9e81adeca2abc68">CLReshapeLayerKernel::configure</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_c_l_tensor.xhtml">ICLTensor</a> *input, <a class="code" href="classarm__compute_1_1_i_c_l_tensor.xhtml">ICLTensor</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a921b705e9e3e0fe928928447869e62a5">ARM_COMPUTE_ERROR_ON_NULLPTR</a>(input, output);</div><div class="line"> <a class="code" href="_error_8h.xhtml#a938dcd406ce611ef5345ad2531cdb948">ARM_COMPUTE_ERROR_THROW_ON</a>(validate_arguments(input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>(), output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()));</div><div class="line"></div><div class="line"> _input = input;</div><div class="line"> _output = output;</div><div class="line"></div><div class="line"> <span class="comment">// Create kernel</span></div><div class="line"> std::set<std::string> build_opts = { <span class="stringliteral">"-DDATA_TYPE="</span> + <a class="code" href="namespacearm__compute.xhtml#a545eeda2eaa3f5a54345ce8169e21184">get_cl_type_from_data_type</a>(input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7cfb31af63202568efef5214acfbf3ba">data_type</a>()) };</div><div class="line"> _kernel = static_cast<cl::Kernel>(<a class="code" href="classarm__compute_1_1_c_l_kernel_library.xhtml#acba005f5ce2c62cbf3f94d074d9007aa">CLKernelLibrary::get</a>().<a class="code" href="namespacearm__compute.xhtml#abc72c95941485d8a068fa38372308574">create_kernel</a>(<span class="stringliteral">"reshape_layer"</span>, build_opts));</div><div class="line"></div><div class="line"> <span class="comment">// Add static arguments</span></div><div class="line"> <span class="keyword">const</span> cl_int2 <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a> =</div><div class="line"> {</div><div class="line"> {</div><div class="line"> static_cast<cl_int>(_input->info()->tensor_shape()[0]),</div><div class="line"> static_cast<cl_int>(_input->info()->tensor_shape()[1])</div><div class="line"> }</div><div class="line"> };</div><div class="line"> <span class="keyword">const</span> cl_int2 <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a> =</div><div class="line"> {</div><div class="line"> {</div><div class="line"> static_cast<cl_int>(_output->info()->tensor_shape()[0]),</div><div class="line"> static_cast<cl_int>(_output->info()->tensor_shape()[1])</div><div class="line"> }</div><div class="line"> };</div><div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx = 2 * num_arguments_per_3D_tensor(); <span class="comment">// Skip the input and output parameters</span></div><div class="line"> _kernel.setArg<cl_int2>(idx++, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>);</div><div class="line"> _kernel.setArg<cl_int2>(idx++, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"></div><div class="line"> <span class="comment">// Configure kernel window</span></div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> win = <a class="code" href="namespacearm__compute.xhtml#ab7980fa5ee693e3282a76da047a1c3b5">calculate_max_window</a>(*input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>());</div><div class="line"></div><div class="line"> <span class="comment">// Set the output valid region</span></div><div class="line"> output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a9586081a29fceb532ab270bd843abee6">set_valid_region</a>(<a class="code" href="structarm__compute_1_1_valid_region.xhtml">ValidRegion</a>(<a class="code" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>(), output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>()));</div><div class="line"> ICLKernel::configure_internal(win);</div><div class="line">}</div><div class="line"></div><div class="line"><a class="code" href="classarm__compute_1_1_status.xhtml">Status</a> <a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#a968b23a6ef327fcfb5b99d58e3fbe883">CLReshapeLayerKernel::validate</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *input, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_error_8h.xhtml#a8a1e1c105f0bdaf37db408c7cfcb77a4">ARM_COMPUTE_RETURN_ON_ERROR</a>(validate_arguments(input, output));</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="classarm__compute_1_1_status.xhtml">Status</a>{};</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#a493987e85723a8000eb26d1f00e2ad0e">CLReshapeLayerKernel::run</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> &window, cl::CommandQueue &queue)</div><div class="line">{</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a1b35b0d258183cf9ef36adf684d0b88c">ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL</a>(<span class="keyword">this</span>);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a6eb9ce82815fe429250189da7592ba75">ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW</a>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">IKernel::window</a>(), window);</div><div class="line"></div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> window_collapsed = window.<a class="code" href="classarm__compute_1_1_window.xhtml#a663ce71e1992366180fcb85b0a874e2f">collapse_if_possible</a>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">ICLKernel::window</a>(), <a class="code" href="classarm__compute_1_1_window.xhtml#a893d17b56b9abc4423ce26e9a24ac5dc">Window::DimZ</a>);</div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a548131b3d37da47a2e9d32111c88dfe1">slice</a> = window_collapsed.<a class="code" href="classarm__compute_1_1_window.xhtml#a30ca5bdbb60ee281d7f1ab34f7a4ee40">first_slice_window_3D</a>();</div><div class="line"></div><div class="line"> <span class="comment">// Set inputs</span></div><div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx = 0;</div><div class="line"> add_3D_tensor_argument(idx, _input, window_collapsed);</div><div class="line"> add_3D_tensor_argument(idx, _output, window_collapsed);</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#a1e48b7cf7de6a52575088cb7082d2b3e">enqueue</a>(queue, *<span class="keyword">this</span>, <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a548131b3d37da47a2e9d32111c88dfe1">slice</a>);</div><div class="line">}</div></div><!-- fragment --><p>The run will call the function defined in the .cl file.</p>
+<p>The structure of the kernel .cpp file should be similar to the next ones. For OpenCL: </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespacearm__compute.xhtml">arm_compute</a>;</div><div class="line"></div><div class="line"><span class="keyword">namespace</span></div><div class="line">{</div><div class="line"><a class="code" href="classarm__compute_1_1_status.xhtml">Status</a> validate_arguments(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *input, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_c_l_validate_8h.xhtml#ab82bd5de18ef067ae5d9ba4af8065dd6">ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED</a>(input);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#ae7eed178dac535c6e727061b1f5bc6eb">ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN</a>(input, 1, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">DataType::U8</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6aafb0fced528eaac5fe170b763cda5975">DataType::S8</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6af14462d71aa842202c3e4b272c7ec924">DataType::QASYMM8</a>,</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aef9ef3ebca4d2b64b6ec83808bafa5f2">DataType::U16</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6e0b0886efb94aec797f6b830329b72c">DataType::S16</a>,</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58ac8bd5bedff8ef192d39a962afc0e19ee">DataType::U32</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aa1e28eee0339658d39a8b4d325b56e9c">DataType::S32</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a56d8353718e6fdc78b8d69078a2cdb94">DataType::F16</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">DataType::F32</a>);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#aff911654521523937ff24372a870b89f">ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR</a>(output);</div><div class="line"></div><div class="line"> <a class="code" href="_validate_8h.xhtml#a8f3ff7da485ff7e75dab07baadf5b4bd">ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES</a>(input, output);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#aba910b683652be1f65437ef37a9da2a9">ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO</a>(input, output);</div><div class="line"> <a class="code" href="_error_8h.xhtml#a206d6e247e0957ac3dee45d27756fc25">ARM_COMPUTE_RETURN_ERROR_ON</a>(input-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>().<a class="code" href="classarm__compute_1_1_tensor_shape.xhtml#a0fdcb923dfd4c74858cc2bc326321efb">total_size</a>() != output-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>().<a class="code" href="classarm__compute_1_1_tensor_shape.xhtml#a0fdcb923dfd4c74858cc2bc326321efb">total_size</a>());</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="classarm__compute_1_1_status.xhtml">Status</a>{};</div><div class="line">}</div><div class="line"></div><div class="line">} <span class="comment">// namespace</span></div><div class="line"></div><div class="line"><a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#ab7a7f679ba9f567fbe64ebc2ad4c4324">CLReshapeLayerKernel::CLReshapeLayerKernel</a>()</div><div class="line"> : _input(nullptr), _output(nullptr)</div><div class="line">{</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#a074e10cfb217e657b9e81adeca2abc68">CLReshapeLayerKernel::configure</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_c_l_tensor.xhtml">ICLTensor</a> *input, <a class="code" href="classarm__compute_1_1_i_c_l_tensor.xhtml">ICLTensor</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a921b705e9e3e0fe928928447869e62a5">ARM_COMPUTE_ERROR_ON_NULLPTR</a>(input, output);</div><div class="line"> <a class="code" href="_error_8h.xhtml#a938dcd406ce611ef5345ad2531cdb948">ARM_COMPUTE_ERROR_THROW_ON</a>(validate_arguments(input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>(), output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()));</div><div class="line"></div><div class="line"> _input = input;</div><div class="line"> _output = output;</div><div class="line"></div><div class="line"> <span class="comment">// Create kernel</span></div><div class="line"> std::set<std::string> build_opts = { <span class="stringliteral">"-DDATA_TYPE="</span> + <a class="code" href="namespacearm__compute.xhtml#a545eeda2eaa3f5a54345ce8169e21184">get_cl_type_from_data_type</a>(input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7cfb31af63202568efef5214acfbf3ba">data_type</a>()) };</div><div class="line"> _kernel = static_cast<cl::Kernel>(<a class="code" href="classarm__compute_1_1_c_l_kernel_library.xhtml#acba005f5ce2c62cbf3f94d074d9007aa">CLKernelLibrary::get</a>().<a class="code" href="namespacearm__compute.xhtml#abc72c95941485d8a068fa38372308574">create_kernel</a>(<span class="stringliteral">"reshape_layer"</span>, build_opts));</div><div class="line"></div><div class="line"> <span class="comment">// Add static arguments</span></div><div class="line"> <span class="keyword">const</span> cl_int2 <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a> =</div><div class="line"> {</div><div class="line"> {</div><div class="line"> static_cast<cl_int>(_input->info()->tensor_shape()[0]),</div><div class="line"> static_cast<cl_int>(_input->info()->tensor_shape()[1])</div><div class="line"> }</div><div class="line"> };</div><div class="line"> <span class="keyword">const</span> cl_int2 <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a> =</div><div class="line"> {</div><div class="line"> {</div><div class="line"> static_cast<cl_int>(_output->info()->tensor_shape()[0]),</div><div class="line"> static_cast<cl_int>(_output->info()->tensor_shape()[1])</div><div class="line"> }</div><div class="line"> };</div><div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx = 2 * num_arguments_per_3D_tensor(); <span class="comment">// Skip the input and output parameters</span></div><div class="line"> _kernel.setArg<cl_int2>(idx++, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>);</div><div class="line"> _kernel.setArg<cl_int2>(idx++, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"></div><div class="line"> <span class="comment">// Configure kernel window</span></div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> win = <a class="code" href="namespacearm__compute.xhtml#ab7980fa5ee693e3282a76da047a1c3b5">calculate_max_window</a>(*input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>());</div><div class="line"></div><div class="line"> <span class="comment">// Set the output valid region</span></div><div class="line"> output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a9586081a29fceb532ab270bd843abee6">set_valid_region</a>(<a class="code" href="structarm__compute_1_1_valid_region.xhtml">ValidRegion</a>(<a class="code" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>(), output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>()));</div><div class="line"> ICLKernel::configure_internal(win);</div><div class="line">}</div><div class="line"></div><div class="line"><a class="code" href="classarm__compute_1_1_status.xhtml">Status</a> <a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#a968b23a6ef327fcfb5b99d58e3fbe883">CLReshapeLayerKernel::validate</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *input, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_error_8h.xhtml#a8a1e1c105f0bdaf37db408c7cfcb77a4">ARM_COMPUTE_RETURN_ON_ERROR</a>(validate_arguments(input, output));</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="classarm__compute_1_1_status.xhtml">Status</a>{};</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="classarm__compute_1_1_c_l_reshape_layer_kernel.xhtml#a493987e85723a8000eb26d1f00e2ad0e">CLReshapeLayerKernel::run</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> &window, cl::CommandQueue &queue)</div><div class="line">{</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a1b35b0d258183cf9ef36adf684d0b88c">ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL</a>(<span class="keyword">this</span>);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a6eb9ce82815fe429250189da7592ba75">ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW</a>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">IKernel::window</a>(), window);</div><div class="line"></div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> window_collapsed = window.<a class="code" href="classarm__compute_1_1_window.xhtml#a663ce71e1992366180fcb85b0a874e2f">collapse_if_possible</a>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">ICLKernel::window</a>(), <a class="code" href="classarm__compute_1_1_window.xhtml#a893d17b56b9abc4423ce26e9a24ac5dc">Window::DimZ</a>);</div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a548131b3d37da47a2e9d32111c88dfe1">slice</a> = window_collapsed.<a class="code" href="classarm__compute_1_1_window.xhtml#a30ca5bdbb60ee281d7f1ab34f7a4ee40">first_slice_window_3D</a>();</div><div class="line"></div><div class="line"> <span class="comment">// Set inputs</span></div><div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx = 0;</div><div class="line"> add_3D_tensor_argument(idx, _input, window_collapsed);</div><div class="line"> add_3D_tensor_argument(idx, _output, window_collapsed);</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#a6e51ab3789678d3e0b0b72178dd6c4c6">enqueue</a>(queue, *<span class="keyword">this</span>, <a class="code" href="namespacearm__compute_1_1test_1_1validation_1_1reference.xhtml#a548131b3d37da47a2e9d32111c88dfe1">slice</a>);</div><div class="line">}</div></div><!-- fragment --><p>The run will call the function defined in the .cl file.</p>
<p>For the NEON backend case: </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespacearm__compute.xhtml">arm_compute</a>;</div><div class="line"></div><div class="line"><span class="keyword">namespace</span></div><div class="line">{</div><div class="line"><a class="code" href="classarm__compute_1_1_status.xhtml">Status</a> validate_arguments(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *input, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_validate_8h.xhtml#aff911654521523937ff24372a870b89f">ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR</a>(input, output);</div><div class="line"> <span class="comment">// Note: ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(input) is not needed here as this kernel doesn't use NEON FP16 instructions.</span></div><div class="line"> <a class="code" href="_validate_8h.xhtml#ae7eed178dac535c6e727061b1f5bc6eb">ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN</a>(input, 1, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">DataType::U8</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6aafb0fced528eaac5fe170b763cda5975">DataType::S8</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6af14462d71aa842202c3e4b272c7ec924">DataType::QASYMM8</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aef9ef3ebca4d2b64b6ec83808bafa5f2">DataType::U16</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6e0b0886efb94aec797f6b830329b72c">DataType::S16</a>,</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58ac8bd5bedff8ef192d39a962afc0e19ee">DataType::U32</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aa1e28eee0339658d39a8b4d325b56e9c">DataType::S32</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a56d8353718e6fdc78b8d69078a2cdb94">DataType::F16</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">DataType::F32</a>);</div><div class="line"></div><div class="line"> <a class="code" href="_validate_8h.xhtml#a8f3ff7da485ff7e75dab07baadf5b4bd">ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES</a>(input, output);</div><div class="line"> <a class="code" href="_error_8h.xhtml#a206d6e247e0957ac3dee45d27756fc25">ARM_COMPUTE_RETURN_ERROR_ON</a>(input-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>().<a class="code" href="classarm__compute_1_1_tensor_shape.xhtml#a0fdcb923dfd4c74858cc2bc326321efb">total_size</a>() != output-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>().<a class="code" href="classarm__compute_1_1_tensor_shape.xhtml#a0fdcb923dfd4c74858cc2bc326321efb">total_size</a>());</div><div class="line"> <a class="code" href="_validate_8h.xhtml#aba910b683652be1f65437ef37a9da2a9">ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO</a>(input, output);</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="classarm__compute_1_1_status.xhtml">Status</a>{};</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line"><span class="keyword">inline</span> <span class="keywordtype">void</span> reshape_tensor(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> &window, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor.xhtml">ITensor</a> *input, <a class="code" href="classarm__compute_1_1_i_tensor.xhtml">ITensor</a> *output)</div><div class="line">{</div><div class="line"> <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a> = input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>();</div><div class="line"> <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_tensor_shape.xhtml">TensorShape</a> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a> = output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>();</div><div class="line"> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> output_coord{};</div><div class="line"></div><div class="line"> <a class="code" href="classarm__compute_1_1_iterator.xhtml">Iterator</a> in(input, window);</div><div class="line"></div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#a5002bf7ec46d52971f9526e94172cfee">execute_window_loop</a>(window, [&](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a> & <span class="keywordtype">id</span>)</div><div class="line"> {</div><div class="line"> output_coord = <a class="code" href="namespacearm__compute.xhtml#ad34f2150f1c9f8a3ecb7298162124e5d">index2coords</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad95e1c14c3007ca18950bf8f4c5a5c93">coords2index</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <span class="keywordtype">id</span>));</div><div class="line"> *reinterpret_cast<T *>(output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#adbd73147d41e8a640bc299d12613c31e">ptr_to_element</a>(output_coord)) = *reinterpret_cast<T *>(in.ptr());</div><div class="line"> },</div><div class="line"> in);</div><div class="line">}</div><div class="line">} <span class="comment">// namespace</span></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="classarm__compute_1_1_n_e_reshape_layer_kernel.xhtml#a83a344e60eb7db895953a942abf16628">NEReshapeLayerKernel::configure</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor.xhtml">ITensor</a> *input, <a class="code" href="classarm__compute_1_1_i_tensor.xhtml">ITensor</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a921b705e9e3e0fe928928447869e62a5">ARM_COMPUTE_ERROR_ON_NULLPTR</a>(input, output);</div><div class="line"> <a class="code" href="_error_8h.xhtml#a938dcd406ce611ef5345ad2531cdb948">ARM_COMPUTE_ERROR_THROW_ON</a>(validate_arguments(input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>(), output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()));</div><div class="line"></div><div class="line"> _input = input;</div><div class="line"> _output = output;</div><div class="line"></div><div class="line"> <span class="comment">// Configure kernel window</span></div><div class="line"> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> win = <a class="code" href="namespacearm__compute.xhtml#ab7980fa5ee693e3282a76da047a1c3b5">calculate_max_window</a>(*input-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>());</div><div class="line"></div><div class="line"> <span class="comment">// Set the output valid region</span></div><div class="line"> output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a9586081a29fceb532ab270bd843abee6">set_valid_region</a>(<a class="code" href="structarm__compute_1_1_valid_region.xhtml">ValidRegion</a>(<a class="code" href="classarm__compute_1_1_coordinates.xhtml">Coordinates</a>(), output-><a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-><a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">tensor_shape</a>()));</div><div class="line"></div><div class="line"> INEKernel::configure(win);</div><div class="line">}</div><div class="line"></div><div class="line"><a class="code" href="classarm__compute_1_1_status.xhtml">Status</a> <a class="code" href="classarm__compute_1_1_n_e_reshape_layer_kernel.xhtml#a968b23a6ef327fcfb5b99d58e3fbe883">NEReshapeLayerKernel::validate</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *input, <span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml">ITensorInfo</a> *output)</div><div class="line">{</div><div class="line"> <a class="code" href="_error_8h.xhtml#a8a1e1c105f0bdaf37db408c7cfcb77a4">ARM_COMPUTE_RETURN_ON_ERROR</a>(validate_arguments(input, output));</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="classarm__compute_1_1_status.xhtml">Status</a>{};</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="classarm__compute_1_1_n_e_reshape_layer_kernel.xhtml#a112b35dd205c62ea6ed1447ef226da82">NEReshapeLayerKernel::run</a>(<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_window.xhtml">Window</a> &window, <span class="keyword">const</span> <a class="code" href="structarm__compute_1_1_thread_info.xhtml">ThreadInfo</a> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a4f4125dba5283887b34f889b1c615c0c">info</a>)</div><div class="line">{</div><div class="line"> <a class="code" href="_error_8h.xhtml#a6dc630a6ae9cc063b3924bcea8dee9d6">ARM_COMPUTE_UNUSED</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a4f4125dba5283887b34f889b1c615c0c">info</a>);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a1b35b0d258183cf9ef36adf684d0b88c">ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL</a>(<span class="keyword">this</span>);</div><div class="line"> <a class="code" href="_validate_8h.xhtml#a6eb9ce82815fe429250189da7592ba75">ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW</a>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">INESimpleKernel::window</a>(), <a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">window</a>);</div><div class="line"></div><div class="line"> <span class="keywordflow">switch</span>(_input->info()->data_type())</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">DataType::U8</a>:</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6aafb0fced528eaac5fe170b763cda5975">DataType::S8</a>:</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6af14462d71aa842202c3e4b272c7ec924">DataType::QASYMM8</a>:</div><div class="line"> reshape_tensor<uint8_t>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">window</a>, _input, _output);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aef9ef3ebca4d2b64b6ec83808bafa5f2">DataType::U16</a>:</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6e0b0886efb94aec797f6b830329b72c">DataType::S16</a>:</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a56d8353718e6fdc78b8d69078a2cdb94">DataType::F16</a>:</div><div class="line"> reshape_tensor<uint16_t>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">window</a>, _input, _output);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58ac8bd5bedff8ef192d39a962afc0e19ee">DataType::U32</a>:</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58aa1e28eee0339658d39a8b4d325b56e9c">DataType::S32</a>:</div><div class="line"> <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">DataType::F32</a>:</div><div class="line"> reshape_tensor<uint32_t>(<a class="code" href="classarm__compute_1_1_i_kernel.xhtml#ad34a46f53686c12a5c5e717cc9617fb6">window</a>, _input, _output);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">default</span>:</div><div class="line"> <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Unsupported data type!"</span>);</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p> In the NEON case, there is no need to add an extra file and we implement the kernel in the same <a class="el" href="_n_e_reshape_layer_kernel_8cpp.xhtml">NEReshapeLayerKernel.cpp</a> file. If the tests are already in place, the new kernel can be tested using the existing tests by adding the configure and run of the kernel to the compute_target() in the fixture.</p>
<h2><a class="anchor" id="S4_1_3_add_function"></a>
Add a function</h2>
@@ -215,10 +215,10 @@
<ul>
<li><a class="el" href="_reshape_layer_8h.xhtml">tests/validation/reference/ReshapeLayer.h</a></li>
</ul>
-<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line">SimpleTensor<T> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<T> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div></div><!-- fragment --><ul>
+<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line">SimpleTensor<T> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<T> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div></div><!-- fragment --><ul>
<li><a class="el" href="tests_2validation_2reference_2_reshape_layer_8cpp.xhtml">tests/validation/reference/ReshapeLayer.cpp</a></li>
</ul>
-<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line">SimpleTensor<T> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<T> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>)</div><div class="line">{</div><div class="line"> <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.shape().total_size() != <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>.total_size());</div><div class="line"></div><div class="line"> SimpleTensor<T> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.data_type());</div><div class="line"> std::copy_n(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.data(), <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.num_elements(), <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.data());</div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">template</span> SimpleTensor<uint8_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<uint8_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<int8_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<int8_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<uint16_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<uint16_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<int16_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<int16_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<uint32_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<uint32_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<int32_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<int32_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<half> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<half> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<float> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<float> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div></div><!-- fragment --><p> An explicit instantiation of the template for the required datatypes must be added in the .cpp file.</p>
+<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line">SimpleTensor<T> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<T> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>)</div><div class="line">{</div><div class="line"> <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.shape().total_size() != <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>.total_size());</div><div class="line"></div><div class="line"> SimpleTensor<T> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.data_type());</div><div class="line"> std::copy_n(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.data(), <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.num_elements(), <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.data());</div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">template</span> SimpleTensor<uint8_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<uint8_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<int8_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<int8_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<uint16_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<uint16_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<int16_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<int16_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<uint32_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<uint32_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<int32_t> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<int32_t> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<half> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<half> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"><span class="keyword">template</span> SimpleTensor<float> <a class="code" href="reshape__layer_8cl.xhtml#acdcb27be2437616997a28a2d8ba45315">reshape_layer</a>(<span class="keyword">const</span> SimpleTensor<float> &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div></div><!-- fragment --><p> An explicit instantiation of the template for the required datatypes must be added in the .cpp file.</p>
<h3><a class="anchor" id="S4_1_4_2_add_dataset"></a>
Add dataset</h3>
<p>One of the parameters of the tests is the dataset, it will be used to generate versions of the test case with different inputs. To pass the dataset at the fixture data test case we have three cases</p><ul>
@@ -232,7 +232,7 @@
Add a fixture and a data test case</h3>
<p>Benchmark and validation tests are based on the same framework to setup and run the tests. In addition to running simple, self-contained test functions the framework supports fixtures and data test cases. Fixtures can be used to share common setup, teardown or even run tasks among multiple test cases, for that purpose a fixture can define a "setup", "teardown" and "run" method. Adding tests for the new operator in the runtime library we need to implement at least the setup method, that is used to call two methods for configure, run and return the output respectively of the target (CL or Neon) and the reference (C++ implementation).</p>
<p>For example let's have a look at Reshape Layer Fixture :</p>
-<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> TensorType, <span class="keyword">typename</span> AccessorType, <span class="keyword">typename</span> FunctionType, <span class="keyword">typename</span> T></div><div class="line"><span class="keyword">class </span>ReshapeLayerValidationFixture : <span class="keyword">public</span> framework::Fixture</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="keyword">template</span> <<span class="keyword">typename</span>...></div><div class="line"> <span class="keywordtype">void</span> setup(TensorShape <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, TensorShape <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>)</div><div class="line"> {</div><div class="line"> _target = compute_target(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"> _reference = compute_reference(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"> <span class="keyword">template</span> <<span class="keyword">typename</span> U></div><div class="line"> <span class="keywordtype">void</span> fill(<a class="code" href="namespacearm__compute.xhtml#a1ce9b523fd4f3b5bbcadcd796183455aa4c614360da93c0a041b22e537de151eb">U</a> &&tensor, <span class="keywordtype">int</span> i)</div><div class="line"> {</div><div class="line"> <a class="code" href="namespacearm__compute_1_1test.xhtml#a71326f0909d77386e29b511e1990a11f">library</a>->fill_tensor_uniform(tensor, i);</div><div class="line"> }</div><div class="line"></div><div class="line"> TensorType compute_target(<span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>)</div><div class="line"> {</div><div class="line"> <span class="comment">// Check if indeed the input shape can be reshape to the output one</span></div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>.total_size() == <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>.total_size(), framework::LogLevel::ERRORS);</div><div class="line"></div><div class="line"> <span class="comment">// Create tensors</span></div><div class="line"> TensorType <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a> = create_tensor<TensorType>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"> TensorType <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a> = create_tensor<TensorType>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"></div><div class="line"> <span class="comment">// Create and configure function</span></div><div class="line"> FunctionType reshape;</div><div class="line"></div><div class="line"> reshape.configure(&<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>);</div><div class="line"></div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.info()->is_resizable(), framework::LogLevel::ERRORS);</div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.<a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml#ad45f0c01a0713dfb6bd7232c7f396fc4">info</a>()-><a class="code" href="classarm__compute_1_1_tensor_info.xhtml#aaee6555ace43b03173844b1a228a3fc3">is_resizable</a>(), framework::LogLevel::ERRORS);</div><div class="line"></div><div class="line"> <span class="comment">// Allocate tensors</span></div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.allocator()->allocate();</div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.<a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml#a4083de30daebd6bdee6b35d9c8262108">allocator</a>()-><a class="code" href="classarm__compute_1_1_c_l_tensor_allocator.xhtml#a6e509c2a177b0b29e9e2369535094dee">allocate</a>();</div><div class="line"></div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(!<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>.info()->is_resizable(), framework::LogLevel::ERRORS);</div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(!<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.<a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml#ad45f0c01a0713dfb6bd7232c7f396fc4">info</a>()-><a class="code" href="classarm__compute_1_1_tensor_info.xhtml#aaee6555ace43b03173844b1a228a3fc3">is_resizable</a>(), framework::LogLevel::ERRORS);</div><div class="line"></div><div class="line"> <span class="comment">// Fill tensors</span></div><div class="line"> fill(AccessorType(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>), 0);</div><div class="line"></div><div class="line"> <span class="comment">// Compute function</span></div><div class="line"> reshape.run();</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>;</div><div class="line"> }</div><div class="line"></div><div class="line"> SimpleTensor<T> compute_reference(<span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>)</div><div class="line"> {</div><div class="line"> <span class="comment">// Create reference</span></div><div class="line"> SimpleTensor<T> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>{ <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a> };</div><div class="line"></div><div class="line"> <span class="comment">// Fill reference</span></div><div class="line"> fill(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, 0);</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> reference::reshape_layer<T>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae9d2dc29c2789c253406f9b304cc75a8">src</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"> }</div><div class="line"></div><div class="line"> TensorType _target{};</div><div class="line"> SimpleTensor<T> _reference{};</div><div class="line">};</div></div><!-- fragment --><p> In the fixture class above we can see that the setup method computes the target and reference and store them in the two members _target and _reference which will be used later to check for correctness. The compute_target method reflects the exact behavior expected when we call a function. The input and output tensor must be declared, function configured, tensors allocated, the input tensor filled with required data, and finally, the function must be run and the results returned. This fixture is used in the test case, that is a parameterized test case that inherits from a fixture. The test case will have access to all public and protected members of the fixture. Only the setup and teardown methods of the fixture will be used. The setup method of the fixture needs to be a template and must accept inputs from the dataset as arguments. The body of this function will be used as a test function. For the fixture test case the first argument is the name of the test case (has to be unique within the enclosing test suite), the second argument is the class name of the fixture, the third argument is the dataset mode in which the test will be active (PRECOMMIT or NIGTHLY) and the fourth argument is the dataset. For example:</p>
+<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> TensorType, <span class="keyword">typename</span> AccessorType, <span class="keyword">typename</span> FunctionType, <span class="keyword">typename</span> T></div><div class="line"><span class="keyword">class </span>ReshapeLayerValidationFixture : <span class="keyword">public</span> framework::Fixture</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="keyword">template</span> <<span class="keyword">typename</span>...></div><div class="line"> <span class="keywordtype">void</span> setup(TensorShape <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, TensorShape <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>)</div><div class="line"> {</div><div class="line"> _target = compute_target(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"> _reference = compute_reference(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"> <span class="keyword">template</span> <<span class="keyword">typename</span> U></div><div class="line"> <span class="keywordtype">void</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a1643f4cb252152ed8ffc0df84744ad5d">fill</a>(<a class="code" href="namespacearm__compute.xhtml#a1ce9b523fd4f3b5bbcadcd796183455aa4c614360da93c0a041b22e537de151eb">U</a> &&tensor, <span class="keywordtype">int</span> i)</div><div class="line"> {</div><div class="line"> <a class="code" href="namespacearm__compute_1_1test.xhtml#a71326f0909d77386e29b511e1990a11f">library</a>->fill_tensor_uniform(tensor, i);</div><div class="line"> }</div><div class="line"></div><div class="line"> TensorType compute_target(<span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>)</div><div class="line"> {</div><div class="line"> <span class="comment">// Check if indeed the input shape can be reshape to the output one</span></div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>.total_size() == <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>.total_size(), framework::LogLevel::ERRORS);</div><div class="line"></div><div class="line"> <span class="comment">// Create tensors</span></div><div class="line"> TensorType <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a> = create_tensor<TensorType>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"> TensorType <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a> = create_tensor<TensorType>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>);</div><div class="line"></div><div class="line"> <span class="comment">// Create and configure function</span></div><div class="line"> FunctionType reshape;</div><div class="line"></div><div class="line"> reshape.configure(&<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>);</div><div class="line"></div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.info()->is_resizable(), framework::LogLevel::ERRORS);</div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.<a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml#ad45f0c01a0713dfb6bd7232c7f396fc4">info</a>()-><a class="code" href="classarm__compute_1_1_tensor_info.xhtml#aaee6555ace43b03173844b1a228a3fc3">is_resizable</a>(), framework::LogLevel::ERRORS);</div><div class="line"></div><div class="line"> <span class="comment">// Allocate tensors</span></div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.allocator()->allocate();</div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.<a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml#a4083de30daebd6bdee6b35d9c8262108">allocator</a>()-><a class="code" href="classarm__compute_1_1_c_l_tensor_allocator.xhtml#a6e509c2a177b0b29e9e2369535094dee">allocate</a>();</div><div class="line"></div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(!<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>.info()->is_resizable(), framework::LogLevel::ERRORS);</div><div class="line"> <a class="code" href="_asserts_8h.xhtml#adc60af942e951dc93e22b97b41809b51">ARM_COMPUTE_EXPECT</a>(!<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>.<a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml#ad45f0c01a0713dfb6bd7232c7f396fc4">info</a>()-><a class="code" href="classarm__compute_1_1_tensor_info.xhtml#aaee6555ace43b03173844b1a228a3fc3">is_resizable</a>(), framework::LogLevel::ERRORS);</div><div class="line"></div><div class="line"> <span class="comment">// Fill tensors</span></div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a1643f4cb252152ed8ffc0df84744ad5d">fill</a>(AccessorType(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>), 0);</div><div class="line"></div><div class="line"> <span class="comment">// Compute function</span></div><div class="line"> reshape.run();</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#adbf67dcee294e673cf796f1ed8aeb6a4">dst</a>;</div><div class="line"> }</div><div class="line"></div><div class="line"> SimpleTensor<T> compute_reference(<span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <span class="keyword">const</span> TensorShape &<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>, <a class="code" href="namespacearm__compute.xhtml#ad8ed01ff3ff33333d8e19db4d2818bb6">DataType</a> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a>)</div><div class="line"> {</div><div class="line"> <span class="comment">// Create reference</span></div><div class="line"> SimpleTensor<T> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>{ <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a865514e30baa11b11c8fa65f944532fb">input_shape</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ac2ad7f431e3446fddcd9b6b9f93c4c14">data_type</a> };</div><div class="line"></div><div class="line"> <span class="comment">// Fill reference</span></div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a1643f4cb252152ed8ffc0df84744ad5d">fill</a>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, 0);</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> reference::reshape_layer<T>(<a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a989ab3e96426615bb98e04e0235088ca">src</a>, <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a7fc93f37dac131a1a40b7921f9df3a9a">output_shape</a>);</div><div class="line"> }</div><div class="line"></div><div class="line"> TensorType _target{};</div><div class="line"> SimpleTensor<T> _reference{};</div><div class="line">};</div></div><!-- fragment --><p> In the fixture class above we can see that the setup method computes the target and reference and store them in the two members _target and _reference which will be used later to check for correctness. The compute_target method reflects the exact behavior expected when we call a function. The input and output tensor must be declared, function configured, tensors allocated, the input tensor filled with required data, and finally, the function must be run and the results returned. This fixture is used in the test case, that is a parameterized test case that inherits from a fixture. The test case will have access to all public and protected members of the fixture. Only the setup and teardown methods of the fixture will be used. The setup method of the fixture needs to be a template and must accept inputs from the dataset as arguments. The body of this function will be used as a test function. For the fixture test case the first argument is the name of the test case (has to be unique within the enclosing test suite), the second argument is the class name of the fixture, the third argument is the dataset mode in which the test will be active (PRECOMMIT or NIGTHLY) and the fourth argument is the dataset. For example:</p>
<div class="fragment"><div class="line"><span class="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line"><span class="keyword">using</span> <a class="code" href="namespacearm__compute_1_1test_1_1benchmark.xhtml#a74a10374253178ae54e1baab173698a1">CLActivationLayerFixture</a> = ActivationValidationFixture<CLTensor, CLAccessor, CLActivationLayer, T>;</div></div><!-- fragment --> <div class="fragment"><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#acd09bed517e43d28823e69494f259835">TEST_SUITE</a>(CL)</div><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#acd09bed517e43d28823e69494f259835">TEST_SUITE</a>(ActivationLayer)</div><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#acd09bed517e43d28823e69494f259835">TEST_SUITE</a>(Float)</div><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#acd09bed517e43d28823e69494f259835">TEST_SUITE</a>(FP16)</div></div><!-- fragment --> <div class="fragment"><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#a42699a26fbdddf91da4aa58a610bb8a8">FIXTURE_DATA_TEST_CASE</a>(RunSmall, CLActivationLayerFixture<half>, framework::DatasetMode::PRECOMMIT, <a class="code" href="namespacearm__compute_1_1test_1_1benchmark.xhtml#ac637b6be52ec2d9a3671f493f8b71042">combine</a>(<a class="code" href="namespacearm__compute_1_1test_1_1benchmark.xhtml#ac637b6be52ec2d9a3671f493f8b71042">combine</a>(datasets::SmallShapes(), ActivationDataset),</div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1framework_1_1dataset.xhtml#a352791fb808d42a82ad70df5efa3508b">framework::dataset::make</a>(<span class="stringliteral">"DataType"</span>,</div><div class="line"> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a56d8353718e6fdc78b8d69078a2cdb94">DataType::F16</a>)))</div><div class="line">{</div><div class="line"> <span class="comment">// Validate output</span></div><div class="line"> <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#ae02c6fc90d9c60c634bfa258049eb46b">validate</a>(CLAccessor(_target), _reference, tolerance(_function, _data_type));</div><div class="line">}</div></div><!-- fragment --><div class="fragment"><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#a603cb7f45efd81606e51686da9aeebd9">TEST_SUITE_END</a>()</div><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#a603cb7f45efd81606e51686da9aeebd9">TEST_SUITE_END</a>()</div><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#a603cb7f45efd81606e51686da9aeebd9">TEST_SUITE_END</a>()</div><div class="line"><a class="code" href="tests_2framework_2_macros_8h.xhtml#a603cb7f45efd81606e51686da9aeebd9">TEST_SUITE_END</a>()</div></div><!-- fragment --><p>This will produce a set of tests that can be filtered with "CL/ReshapeLayer/Float/FP16/RunSmall". Each test produced from the cartesian product of the dataset is associated to a number and can be filtered specifying all the parameters. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
@@ -240,7 +240,7 @@
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
- <li class="footer">Generated on Thu Feb 28 2019 12:24:57 for Compute Library by
+ <li class="footer">Generated on Thu May 23 2019 17:11:27 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>