COMPMID-1277 - Optimizing CLIm2ColKernel for NHWC.
This patch includes:
- Im2Col optimizations for NHWC using a new data layout
- Refactoring of CLIm2ColKernel adding validation method and auto-init
- Removed im2col_reduced from CLIm2ColKernel and created a new kernel CLFlattenLayerKernel
Change-Id: I1620640b6796baa268324b33ae92cdd8de53e27c
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/141241
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
diff --git a/tests/validation/fixtures/Im2ColFixture.h b/tests/validation/fixtures/Im2ColFixture.h
index f72e38f..da2576b 100644
--- a/tests/validation/fixtures/Im2ColFixture.h
+++ b/tests/validation/fixtures/Im2ColFixture.h
@@ -49,7 +49,8 @@
{
public:
template <typename...>
- void setup(TensorShape input_shape, DataType data_type, const Size2D &kernel_dims, const PadStrideInfo &conv_info, const QuantizationInfo &quant_info, const DataLayout &data_layout)
+ void setup(TensorShape input_shape, DataType data_type, const Size2D &kernel_dims, const PadStrideInfo &conv_info, const QuantizationInfo &quant_info, const DataLayout &data_layout,
+ bool channels_first_output_nhwc)
{
_kernel_dims = kernel_dims;
_conv_info = conv_info;
@@ -68,7 +69,7 @@
const TensorShape output_shape = compute_im2col_conv_shape(&input_info, _kernel_dims, _conv_info, _has_bias, Size2D(1U, 1U), batch_size_on_z);
_target = compute_target(input_shape, output_shape, data_type);
- compute_reference(input_shape, output_shape, data_type);
+ compute_reference(input_shape, output_shape, data_type, channels_first_output_nhwc);
}
protected:
@@ -107,14 +108,16 @@
return dst;
}
- void compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type)
+ void compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type, bool channels_first_output_nhwc)
{
// Create reference
SimpleTensor<T> src{ input_shape, data_type, 1, _quant_info, _data_layout };
_reference = SimpleTensor<T>(output_shape, data_type, 1, _quant_info, DataLayout::NCHW);
+
// Fill reference
fill(src);
- reference::im2col<T>(src, _reference, _kernel_dims, _conv_info, _has_bias);
+
+ reference::im2col<T>(src, _reference, _kernel_dims, _conv_info, _has_bias, channels_first_output_nhwc);
}
TensorType _target{};
SimpleTensor<T> _reference{};