From ced7a8d0b4fe77d750a1e55883d5886ad9760f3b Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 1 Feb 2018 16:31:33 +0000 Subject: COMPMID-875: Deconvolution 4x4 not working -Enforces the use of the ConvolutionLayer function in the DeconvolutionLayer. -Adds tests for 4x4 Deconvolution. -Alters the ConvolutionLayer validation to support even kernels. Change-Id: Id27e285f078e690b8dd58490dd8ea6d875b3cec6 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118632 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- src/runtime/NEON/functions/NEDeconvolutionLayer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/runtime/NEON') diff --git a/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp b/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp index 7bce8a6b7c..b293fa080a 100644 --- a/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -33,11 +33,13 @@ using namespace arm_compute::misc::shape_calculator; NEDeconvolutionLayer::NEDeconvolutionLayer(std::shared_ptr memory_manager) // NOLINT : _memory_group(std::move(memory_manager)), + _direct_conv_f(), _conv_f(), _scaled_output(), _input(nullptr), _info(), - _inner_border() + _inner_border(), + _run_direct_convolution(false) { } @@ -47,11 +49,12 @@ void NEDeconvolutionLayer::configure(ITensor *input, const ITensor *weights, con ARM_COMPUTE_ERROR_ON_NULLPTR(output); ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F32); ARM_COMPUTE_ERROR_ON(weights->info()->dimension(0) != weights->info()->dimension(1)); - ARM_COMPUTE_ERROR_ON(weights->info()->dimension(0) != 1 && weights->info()->dimension(0) != 3 && weights->info()->dimension(0) != 5); _input = input; _info = info; _inner_border = std::make_pair(inner_border_right, inner_border_top); + // FIXME: ConvolutionLayer Segfaults in GEMM assembly code for 1x1 convolutions + _run_direct_convolution = (weights->info()->dimension(0) == weights->info()->dimension(1)) && (weights->info()->dimension(0) == 1); const unsigned int stride_x = info.stride().first; const unsigned int stride_y = info.stride().second; @@ -75,7 +78,9 @@ void NEDeconvolutionLayer::configure(ITensor *input, const ITensor *weights, con // setup the function to convolve the upscaled output const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL); - _conv_f.configure(&_scaled_output, weights, bias, output, conv_info); + (_run_direct_convolution) ? _direct_conv_f.configure(&_scaled_output, weights, bias, output, conv_info) : _conv_f.configure(&_scaled_output, weights, bias, output, conv_info); + + // Allocate auxiliary tensors _scaled_output.allocator()->allocate(); } @@ -92,7 +97,7 @@ void NEDeconvolutionLayer::run() const int stride_x = _info.stride().first; const int stride_y = _info.stride().second; - std::fill_n(reinterpret_cast(_scaled_output.buffer()), _scaled_output.info()->tensor_shape().total_size(), 0.f); + std::fill_n(_scaled_output.buffer(), _scaled_output.info()->total_size(), 0); // scaled_output is the input for the forward convolution. We copy the input elements to scaled_output // and insert rows and columns with zeroes depending on the stride values. @@ -113,6 +118,8 @@ void NEDeconvolutionLayer::run() } } - _conv_f.run(); + // Run convolution layer + (_run_direct_convolution) ? _direct_conv_f.run() : _conv_f.run(); + _memory_group.release(); } -- cgit v1.2.1