aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2019-06-17 12:04:40 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-07-11 16:14:01 +0000
commitc1b76faf6be5c33dbf3269faea95e185ac37992f (patch)
treec52ecf022bf8b5e54844258744e6a10619b68d83 /src/runtime
parent0ec65b8c6438b6d12f17487fdc4c870fe37c7caa (diff)
downloadComputeLibrary-c1b76faf6be5c33dbf3269faea95e185ac37992f.tar.gz
COMPMID-2092: Refactoring interface for the deconvolution kernels (NEON/CL)
3RDPARTY_UPDATE Change-Id: Id7ddf97e2c9ceb2cb84084fab2c6f5697890c193 Signed-off-by: giuros01 <giuseppe.rossini@arm.com> Reviewed-on: https://review.mlplatform.org/c/1424 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/CL/functions/CLDeconvolutionLayer.cpp19
-rw-r--r--src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp12
-rw-r--r--src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp9
-rw-r--r--src/runtime/CPP/functions/CPPUpsample.cpp8
-rw-r--r--src/runtime/NEON/functions/NEDeconvolutionLayer.cpp30
5 files changed, 22 insertions, 56 deletions
diff --git a/src/runtime/CL/functions/CLDeconvolutionLayer.cpp b/src/runtime/CL/functions/CLDeconvolutionLayer.cpp
index c6f79d341f..7aa771428d 100644
--- a/src/runtime/CL/functions/CLDeconvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLDeconvolutionLayer.cpp
@@ -42,10 +42,9 @@ CLDeconvolutionLayer::CLDeconvolutionLayer(std::shared_ptr<IMemoryManager> memor
}
void CLDeconvolutionLayer::configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &deconv_info,
- unsigned int inner_border_right, unsigned int inner_border_top, const WeightsInfo &weights_info)
+ const WeightsInfo &weights_info)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output);
- ARM_COMPUTE_UNUSED(inner_border_right, inner_border_top);
switch(CLDeconvolutionLayer::get_deconvolution_method(input->info(), weights->info(), nullptr, output->info(), deconv_info, weights_info))
{
@@ -70,11 +69,9 @@ void CLDeconvolutionLayer::configure(ICLTensor *input, ICLTensor *weights, const
}
Status CLDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &deconv_info,
- unsigned int inner_border_right, unsigned int inner_border_top, const WeightsInfo &weights_info)
+ const WeightsInfo &weights_info)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, weights, output);
- ARM_COMPUTE_UNUSED(inner_border_right, inner_border_top);
-
switch(CLDeconvolutionLayer::get_deconvolution_method(input, weights, bias, output, deconv_info, weights_info))
{
case DeconvolutionMethod::DIRECT:
@@ -115,18 +112,6 @@ DeconvolutionMethod CLDeconvolutionLayer::get_deconvolution_method(const ITensor
return DeconvolutionMethod::GEMM;
}
-void CLDeconvolutionLayer::configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &deconv_info,
- const WeightsInfo &weights_info)
-{
- configure(input, weights, bias, output, deconv_info, 0, 0, weights_info);
-}
-
-Status CLDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &deconv_info,
- const WeightsInfo &weights_info)
-{
- return CLDeconvolutionLayer::validate(input, weights, bias, output, deconv_info, 0, 0, weights_info);
-}
-
void CLDeconvolutionLayer::run()
{
prepare();
diff --git a/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp b/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp
index c66dff01c5..63a45aae8e 100644
--- a/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp
+++ b/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp
@@ -36,20 +36,18 @@ CLDeconvolutionLayerUpsample::CLDeconvolutionLayerUpsample() // NOLINT
{
}
-Status CLDeconvolutionLayerUpsample::validate(const ITensorInfo *input, const ITensorInfo *output, const BorderSize &inner_border,
- const PadStrideInfo &info)
+Status CLDeconvolutionLayerUpsample::validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info)
{
- return CLDeconvolutionLayerUpsampleKernel::validate(input, output, inner_border, info);
+ return CLDeconvolutionLayerUpsampleKernel::validate(input, output, info);
}
-void CLDeconvolutionLayerUpsample::configure(ICLTensor *input, ICLTensor *output, const BorderSize &inner_border,
- const PadStrideInfo &info)
+void CLDeconvolutionLayerUpsample::configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
_output = output;
_memset.configure(_output, PixelValue(0, _output->info()->data_type(), _output->info()->quantization_info()));
- _upsample.configure(input, _output, inner_border, info);
+ _upsample.configure(input, _output, info);
}
void CLDeconvolutionLayerUpsample::run()
@@ -57,4 +55,4 @@ void CLDeconvolutionLayerUpsample::run()
CLScheduler::get().enqueue(_memset, false);
CLScheduler::get().enqueue(_upsample, true);
}
-} // namespace arm_compute \ No newline at end of file
+} // namespace arm_compute
diff --git a/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp b/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp
index 6e14e26cbd..c1a39ef26a 100644
--- a/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp
@@ -55,7 +55,6 @@ Status CLDirectDeconvolutionLayer::validate(const ITensorInfo *input, const ITen
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, weights, output);
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_LAYOUT(input, weights);
-
const DataLayout data_layout = input->data_layout();
const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
@@ -95,11 +94,11 @@ Status CLDirectDeconvolutionLayer::validate(const ITensorInfo *input, const ITen
unsigned int padx = 0;
unsigned int pady = 0;
- const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, 0, 0, out_dims, padx, pady);
+ const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, out_dims, padx, pady);
TensorInfo scale_out_info(input->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(scale_out_shape).set_data_layout(data_layout));
const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
- ARM_COMPUTE_RETURN_ON_ERROR(CLDeconvolutionLayerUpsample::validate(input, &scale_out_info, BorderSize(), info));
+ ARM_COMPUTE_RETURN_ON_ERROR(CLDeconvolutionLayerUpsample::validate(input, &scale_out_info, info));
ARM_COMPUTE_RETURN_ON_ERROR(CLConvolutionLayer::validate(&scale_out_info, weights, bias, output, conv_info, weights_info));
return Status{};
@@ -141,7 +140,7 @@ void CLDirectDeconvolutionLayer::configure(ICLTensor *input, ICLTensor *weights,
// Find the upsampled dimensions and the padding needed for the convolution with stride 1 in order to match output shape
unsigned int padx = 0;
unsigned int pady = 0;
- const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input->info(), *weights->info(), stride_x, stride_y, 0, 0, out_dims, padx, pady);
+ const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input->info(), *weights->info(), stride_x, stride_y, out_dims, padx, pady);
TensorInfo scale_out_info(scale_out_shape, 1, input->info()->data_type(), input->info()->quantization_info());
scale_out_info.set_data_layout(data_layout);
@@ -149,7 +148,7 @@ void CLDirectDeconvolutionLayer::configure(ICLTensor *input, ICLTensor *weights,
// configure scale function
const PadStrideInfo upsample_info(stride_x, stride_y, padx / 2, pady / 2);
- _scale_f.configure(input, &_scaled_output, BorderSize(), upsample_info);
+ _scale_f.configure(input, &_scaled_output, upsample_info);
// Setup the function to convolve the upscaled output
const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
diff --git a/src/runtime/CPP/functions/CPPUpsample.cpp b/src/runtime/CPP/functions/CPPUpsample.cpp
index 619b7e1f43..0fd7d9394f 100644
--- a/src/runtime/CPP/functions/CPPUpsample.cpp
+++ b/src/runtime/CPP/functions/CPPUpsample.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,9 +28,9 @@
using namespace arm_compute;
-void CPPUpsample::configure(const ITensor *input, ITensor *output, const PadStrideInfo &info, unsigned int inner_border_right, unsigned int inner_border_top)
+void CPPUpsample::configure(const ITensor *input, ITensor *output, const PadStrideInfo &info)
{
auto k = arm_compute::support::cpp14::make_unique<CPPUpsampleKernel>();
- k->configure(input, output, info, inner_border_right, inner_border_top);
+ k->configure(input, output, info);
_kernel = std::move(k);
-} \ No newline at end of file
+}
diff --git a/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp b/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp
index c3d6b94d8d..7bbacb139c 100644
--- a/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp
@@ -43,13 +43,11 @@ NEDeconvolutionLayer::NEDeconvolutionLayer(std::shared_ptr<IMemoryManager> memor
_original_weights(nullptr),
_input(nullptr),
_info(),
- _inner_border(),
_is_prepared(false)
{
}
-Status NEDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &info,
- unsigned int inner_border_right, unsigned int inner_border_top)
+Status NEDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &info)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, weights, output);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F32, DataType::F16, DataType::QASYMM8);
@@ -61,9 +59,6 @@ Status NEDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInf
const unsigned int stride_x = info.stride().first;
const unsigned int stride_y = info.stride().second;
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(inner_border_right > stride_x - 1, "inner_border_right must be smaller than stride_x");
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(inner_border_top > stride_y - 1, "inner_border_top must be smaller than stride_y");
-
auto out_dims = deconvolution_output_dimensions(input->dimension(0), input->dimension(1), weights->dimension(0), weights->dimension(1),
info.pad().first, info.pad().second, stride_x, stride_y);
@@ -91,7 +86,7 @@ Status NEDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInf
unsigned int padx = 0;
unsigned int pady = 0;
- const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, inner_border_right, inner_border_top, out_dims, padx, pady);
+ const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, out_dims, padx, pady);
TensorInfo scale_out_info(input->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(scale_out_shape));
const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
@@ -105,15 +100,13 @@ Status NEDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInf
return Status{};
}
-void NEDeconvolutionLayer::configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &info,
- unsigned int inner_border_right, unsigned int inner_border_top)
+void NEDeconvolutionLayer::configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &info)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output);
_input = input;
_original_weights = weights;
_info = info;
- _inner_border = std::make_pair(inner_border_right, inner_border_top);
_is_prepared = false;
const DataLayout data_layout = input->info()->data_layout();
@@ -131,35 +124,26 @@ void NEDeconvolutionLayer::configure(ITensor *input, const ITensor *weights, con
auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type(), input->info()->quantization_info());
// Perform validation step
- ARM_COMPUTE_ERROR_THROW_ON(NEDeconvolutionLayer::validate(input->info(), weights->info(), bias == nullptr ? nullptr : bias->info(), output->info(), info, inner_border_right, inner_border_top));
+ ARM_COMPUTE_ERROR_THROW_ON(NEDeconvolutionLayer::validate(input->info(), weights->info(), bias == nullptr ? nullptr : bias->info(), output->info(), info));
_memory_group.manage(&_scaled_output);
// Find the upsampled dimensions and the padding needed for the convolution with stride 1 in order to match output shape
unsigned int padx = 0;
unsigned int pady = 0;
- const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input->info(), *weights->info(), stride_x, stride_y, inner_border_right, inner_border_top, out_dims, padx, pady);
+ const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input->info(), *weights->info(), stride_x, stride_y, out_dims, padx, pady);
TensorInfo scale_out_info(scale_out_shape, 1, input->info()->data_type(), input->info()->quantization_info());
_scaled_output.allocator()->init(scale_out_info);
const PadStrideInfo upsample_info(stride_x, stride_y, padx / 2, pady / 2);
- _upsample_f.configure(input, &_scaled_output, upsample_info, inner_border_right, inner_border_top);
+ _upsample_f.configure(input, &_scaled_output, upsample_info);
// 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_flipped, bias, output, conv_info);
_scaled_output.allocator()->allocate();
}
-Status NEDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &info)
-{
- return NEDeconvolutionLayer::validate(input, weights, bias, output, info, 0, 0);
-}
-
-void NEDeconvolutionLayer::configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &info)
-{
- configure(input, weights, bias, output, info, 0, 0);
-}
void NEDeconvolutionLayer::run()
{
@@ -193,4 +177,4 @@ void NEDeconvolutionLayer::prepare()
_is_prepared = true;
}
}
-} // namespace arm_compute \ No newline at end of file
+} // namespace arm_compute