diff options
author | Gian Marco Iodice <gianmarco.iodice@arm.com> | 2018-06-28 16:29:29 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | 215b4ea6c9dee480a22070d5873b0b8cb52531a0 (patch) | |
tree | 398e552c4d01c0b84d03a873098a9183ba8f82e4 /src/core/NEON/kernels | |
parent | ad486e21e5870f41774f30825c270762e08ae71e (diff) | |
download | ComputeLibrary-215b4ea6c9dee480a22070d5873b0b8cb52531a0.tar.gz |
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>
Diffstat (limited to 'src/core/NEON/kernels')
-rw-r--r-- | src/core/NEON/kernels/NEIm2ColKernel.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/core/NEON/kernels/NEIm2ColKernel.cpp b/src/core/NEON/kernels/NEIm2ColKernel.cpp index 61010711a6..8cb4f4b889 100644 --- a/src/core/NEON/kernels/NEIm2ColKernel.cpp +++ b/src/core/NEON/kernels/NEIm2ColKernel.cpp @@ -49,29 +49,26 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, c { ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(input); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::F16, DataType::F32); - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); ARM_COMPUTE_RETURN_ERROR_ON(input->data_type() == DataType::QASYMM8 && has_bias); ARM_COMPUTE_RETURN_ERROR_ON((dilation.x() < 1) || (dilation.y() < 1)); - TensorShape expected_output_shape; - if(is_flatten) /* Called by FlattenLayer */ + if(output->total_size() > 0) { - expected_output_shape = misc::shape_calculator::compute_im2col_flatten_shape(input); - } - else if(!is_fully_connected) /* Called by ConvolutionLayer */ - { - expected_output_shape = misc::shape_calculator::compute_im2col_conv_shape(input, kernel_dims, conv_info, has_bias, dilation, false); - } - else /* Called by FullyConnectedLayer */ - { - const int num_batch_dimensions = std::max(0, static_cast<int>(output->tensor_shape().num_dimensions()) - 1); - const int num_input_dimensions = input->tensor_shape().num_dimensions() - num_batch_dimensions; + TensorShape expected_output_shape; - expected_output_shape = misc::shape_calculator::compute_im2col_fc_shape(input, num_input_dimensions); - } + if(is_flatten || is_fully_connected) + { + expected_output_shape = misc::shape_calculator::compute_flatten_shape(input); + } + else + { + expected_output_shape = misc::shape_calculator::compute_im2col_conv_shape(input, kernel_dims, conv_info, has_bias, dilation, false); + } - TensorInfo expected_output = output->clone()->set_tensor_shape(expected_output_shape); - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(&expected_output, output); + TensorInfo expected_output = output->clone()->set_tensor_shape(expected_output_shape); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(&expected_output, output); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); + } return Status{}; } |