From dfca60b8e8805966624c7c941f289e090e3d73bb Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Wed, 31 Jan 2018 10:30:59 +0000 Subject: COMPMID-811 Add NHWC data format support for CL depthwise convolution QASYMM8 Change-Id: I89de432f3fbcba7abf9e1d4f8396a4334b4fa2c2 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118324 Tested-by: Jenkins Reviewed-by: Gian Marco Iodice --- .../CL/functions/CLDepthwiseConvolutionLayer.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp') diff --git a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp index 8d7c92bdf1..0276b37e09 100644 --- a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp @@ -35,7 +35,7 @@ using namespace arm_compute::misc; using namespace arm_compute::misc::shape_calculator; CLDepthwiseConvolutionLayer3x3::CLDepthwiseConvolutionLayer3x3() - : _kernel(), _border_handler() + : _kernel(nullptr), _border_handler() { } @@ -44,8 +44,17 @@ void CLDepthwiseConvolutionLayer3x3::configure(ICLTensor *input, const ICLTensor ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::F16, DataType::F32); ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, weights); - _kernel.set_target(CLScheduler::get().target()); - _kernel.configure(input, weights, biases, output, conv_info, act_info); + if(input->info()->data_layout() == DataLayout::NCHW) + { + _kernel = arm_compute::support::cpp14::make_unique(); + } + else + { + _kernel = arm_compute::support::cpp14::make_unique(); + } + + _kernel->set_target(CLScheduler::get().target()); + _kernel->configure(input, weights, biases, output, conv_info, act_info); // Configure border handler PixelValue &&zero_value(0.f); @@ -53,13 +62,13 @@ void CLDepthwiseConvolutionLayer3x3::configure(ICLTensor *input, const ICLTensor { zero_value = PixelValue(static_cast(input->info()->quantization_info().offset)); } - _border_handler.configure(input, _kernel.border_size(), BorderMode::CONSTANT, zero_value); + _border_handler.configure(input, _kernel->border_size(), BorderMode::CONSTANT, zero_value); } void CLDepthwiseConvolutionLayer3x3::run() { CLScheduler::get().enqueue(_border_handler); - CLScheduler::get().enqueue(_kernel); + CLScheduler::get().enqueue(*_kernel); } CLDepthwiseConvolutionLayer::CLDepthwiseConvolutionLayer() -- cgit v1.2.1