aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-10-27 12:01:23 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit5cbd20f10f1a51dc177c4e9e7c0be01261870260 (patch)
tree4df16a37d88d5fa3434c64a7e8a788eeb431dfe1 /src
parent1f378ee7639837601f5152ee9f185ee1a528d643 (diff)
downloadComputeLibrary-5cbd20f10f1a51dc177c4e9e7c0be01261870260.tar.gz
COMPMID-556: Autoconfigure support in CLDepthwiseConvolution.
Change-Id: I697d3237b39d0f088b820c14b65cfcbbd2e26e09 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93412 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/CL/kernels/CLDepthwiseVectorToTensorKernel.cpp11
-rw-r--r--src/runtime/CL/functions/CLDepthwiseConvolution.cpp23
2 files changed, 22 insertions, 12 deletions
diff --git a/src/core/CL/kernels/CLDepthwiseVectorToTensorKernel.cpp b/src/core/CL/kernels/CLDepthwiseVectorToTensorKernel.cpp
index 2086b1de03..dc47bb0adc 100644
--- a/src/core/CL/kernels/CLDepthwiseVectorToTensorKernel.cpp
+++ b/src/core/CL/kernels/CLDepthwiseVectorToTensorKernel.cpp
@@ -42,6 +42,17 @@ CLDepthwiseVectorToTensorKernel::CLDepthwiseVectorToTensorKernel()
void CLDepthwiseVectorToTensorKernel::configure(const ICLTensor *input, ICLTensor *output, size_t conv_w, size_t conv_h)
{
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16, DataType::F32);
+ ARM_COMPUTE_ERROR_ON_NULLPTR(output);
+
+ TensorShape output_shape = input->info()->tensor_shape();
+ output_shape.set(0, conv_w);
+ output_shape.set(1, conv_h);
+ output_shape.set(2, input->info()->tensor_shape()[0] / (conv_w * conv_h));
+
+ // Output auto inizialitation if not yet initialized
+ auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type(), input->info()->fixed_point_position());
+
+ ARM_COMPUTE_ERROR_ON_MISMATCHING_DIMENSIONS(output->info()->tensor_shape(), output_shape);
ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
ARM_COMPUTE_ERROR_ON_MISMATCHING_FIXED_POINT(input, output);
diff --git a/src/runtime/CL/functions/CLDepthwiseConvolution.cpp b/src/runtime/CL/functions/CLDepthwiseConvolution.cpp
index ffd9f40f4f..bfc792c942 100644
--- a/src/runtime/CL/functions/CLDepthwiseConvolution.cpp
+++ b/src/runtime/CL/functions/CLDepthwiseConvolution.cpp
@@ -60,7 +60,6 @@ CLDepthwiseConvolution::CLDepthwiseConvolution()
void CLDepthwiseConvolution::configure(ICLTensor *input, ICLTensor *output, const ICLTensor *weights, const ICLTensor *biases, const PadStrideInfo &conv_info)
{
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F32);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::F32);
ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, weights);
ARM_COMPUTE_ERROR_ON(input->info()->dimension(2) != weights->info()->dimension(2));
@@ -78,28 +77,28 @@ void CLDepthwiseConvolution::configure(ICLTensor *input, ICLTensor *output, cons
const size_t patch_size = weights_w * weights_h + ((has_bias) ? 1 : 0);
const size_t conv_size = conv_w * conv_h;
+ // Im2Col configuration
TensorShape shape_im2col = input->info()->tensor_shape();
shape_im2col.set(0, patch_size);
shape_im2col.set(1, conv_size);
shape_im2col.set(2, weights_z);
+ const TensorInfo info_im2col(shape_im2col, 1, input->info()->data_type(), input->info()->fixed_point_position());
+ _input_reshaped.allocator()->init(info_im2col);
+ _im2col_kernel.configure(input, &_input_reshaped, Size2D(weights_w, weights_h), conv_info, has_bias);
+ // Weights reshape configuration
const TensorShape shape_weights_reshape(patch_size, weights_z);
- TensorShape shape_v2mm_out = output->info()->tensor_shape();
+ const TensorInfo info_weights_reshape(shape_weights_reshape, 1, weights->info()->data_type(), weights->info()->fixed_point_position());
+ _weights_reshaped.allocator()->init(info_weights_reshape);
+ _weights_reshape_kernel.configure(weights, &_weights_reshaped, biases);
+
+ // GEMV configuration
+ TensorShape shape_v2mm_out = input->info()->tensor_shape();
shape_v2mm_out.set(0, conv_size * weights_z);
shape_v2mm_out.set(1, 1);
shape_v2mm_out.set(2, 1);
-
- const TensorInfo info_im2col(shape_im2col, 1, input->info()->data_type(), input->info()->fixed_point_position());
- const TensorInfo info_weights_reshape(shape_weights_reshape, 1, weights->info()->data_type(), weights->info()->fixed_point_position());
const TensorInfo info_v2mm_out(shape_v2mm_out, 1, input->info()->data_type(), input->info()->fixed_point_position());
-
- _input_reshaped.allocator()->init(info_im2col);
- _weights_reshaped.allocator()->init(info_weights_reshape);
_v2mm_output.allocator()->init(info_v2mm_out);
-
- // Configure kernels
- _im2col_kernel.configure(input, &_input_reshaped, Size2D(weights_w, weights_h), conv_info, has_bias);
- _weights_reshape_kernel.configure(weights, &_weights_reshaped, biases);
_v2mm_kernel.configure(&_input_reshaped, &_weights_reshaped, &_v2mm_output);
_vector_to_tensor_kernel.configure(&_v2mm_output, output, conv_w, conv_h);