diff options
author | Pablo Tello <pablo.tello@arm.com> | 2017-07-26 10:28:40 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:16:42 +0100 |
commit | f87cc7f6fef95f9b022725304118796a6a764a7c (patch) | |
tree | 06a643c47c93ba1a64dcca1ae787214a6fbfff54 /src/runtime | |
parent | 6c928343b0fa2bf60ffdfe21aea28b598d742ed4 (diff) | |
download | ComputeLibrary-f87cc7f6fef95f9b022725304118796a6a764a7c.tar.gz |
COMPMID-417: Port NEDirectConvolution 1x1 to QS16.
Change-Id: Icae6a5091e836d0aca24375f43cca9e6d3a2090f
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81662
Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/runtime')
-rw-r--r-- | src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp index d5f03fcc41..0380e8cdb4 100644 --- a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp @@ -40,7 +40,7 @@ NEDirectConvolutionLayer::NEDirectConvolutionLayer() void NEDirectConvolutionLayer::configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &conv_info) { - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::QS8, DataType::F16, DataType::F32); + ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::QS8, DataType::QS16, DataType::F16, DataType::F32); // Free accumulator if(_accumulator.buffer() != nullptr) @@ -49,17 +49,36 @@ void NEDirectConvolutionLayer::configure(ITensor *input, const ITensor *weights, } // Allocate the intermediate accumulator tensor in case of fixed point input - if(output->info()->data_type() == DataType::QS8) + switch(output->info()->data_type()) { - _accumulator.allocator()->init(TensorInfo(output->info()->tensor_shape(), 1, DataType::QS16, output->info()->fixed_point_position())); - _conv_kernel.configure(input, weights, &_accumulator, conv_info); - _accumulate_bias_kernel.configure(&_accumulator, bias, output); - _accumulator.allocator()->allocate(); - } - else - { - _conv_kernel.configure(input, weights, output, conv_info); - _accumulate_bias_kernel.configure(output, bias); + case DataType::QS8: + { + _accumulator.allocator()->init(TensorInfo(output->info()->tensor_shape(), 1, DataType::QS16, output->info()->fixed_point_position())); + _conv_kernel.configure(input, weights, &_accumulator, conv_info); + _accumulate_bias_kernel.configure(&_accumulator, bias, output); + _accumulator.allocator()->allocate(); + break; + } + case DataType::QS16: + { + _accumulator.allocator()->init(TensorInfo(output->info()->tensor_shape(), 1, DataType::QS32, output->info()->fixed_point_position())); + _conv_kernel.configure(input, weights, &_accumulator, conv_info); + _accumulate_bias_kernel.configure(&_accumulator, bias, output); + _accumulator.allocator()->allocate(); + break; + } + case DataType::F16: + case DataType::F32: + { + _conv_kernel.configure(input, weights, output, conv_info); + _accumulate_bias_kernel.configure(output, bias); + break; + } + default: + { + ARM_COMPUTE_ERROR("Data type not supported"); + break; + } } // Add zero padding XY |