From c1b76faf6be5c33dbf3269faea95e185ac37992f Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Mon, 17 Jun 2019 12:04:40 +0100 Subject: COMPMID-2092: Refactoring interface for the deconvolution kernels (NEON/CL) 3RDPARTY_UPDATE Change-Id: Id7ddf97e2c9ceb2cb84084fab2c6f5697890c193 Signed-off-by: giuros01 Reviewed-on: https://review.mlplatform.org/c/1424 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas --- 3rdparty | 2 +- .../kernels/CLDeconvolutionLayerUpsampleKernel.h | 21 ++++++------ arm_compute/core/CPP/kernels/CPPUpsampleKernel.h | 11 +++---- arm_compute/core/utils/misc/ShapeCalculator.h | 23 ++++++-------- arm_compute/graph/GraphBuilder.h | 3 +- arm_compute/graph/backends/FunctionHelpers.h | 5 ++- arm_compute/graph/frontend/Layers.h | 20 +++++------- arm_compute/graph/nodes/DeconvolutionLayerNode.h | 13 ++------ .../runtime/CL/functions/CLDeconvolutionLayer.h | 34 -------------------- .../CL/functions/CLDeconvolutionLayerUpsample.h | 20 +++++------- arm_compute/runtime/CPP/functions/CPPUpsample.h | 10 +++--- .../runtime/NEON/functions/NEDeconvolutionLayer.h | 34 +------------------- docs/00_introduction.dox | 2 ++ .../kernels/CLDeconvolutionLayerUpsampleKernel.cpp | 22 ++++++------- src/core/CPP/kernels/CPPUpsampleKernel.cpp | 15 ++++----- src/graph/GraphBuilder.cpp | 4 +-- src/graph/nodes/DeconvolutionLayerNode.cpp | 11 ++----- src/runtime/CL/functions/CLDeconvolutionLayer.cpp | 19 ++--------- .../CL/functions/CLDeconvolutionLayerUpsample.cpp | 12 +++---- .../CL/functions/CLDirectDeconvolutionLayer.cpp | 9 +++--- src/runtime/CPP/functions/CPPUpsample.cpp | 8 ++--- .../NEON/functions/NEDeconvolutionLayer.cpp | 30 ++++-------------- tests/validation/CL/DeconvolutionLayer.cpp | 32 ++++++------------- tests/validation/NEON/DeconvolutionLayer.cpp | 37 +++++++--------------- 24 files changed, 116 insertions(+), 281 deletions(-) diff --git a/3rdparty b/3rdparty index e7db29bce5..62d7cad729 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit e7db29bce5b11c7d76f43b447f1d5ec24fe2fc85 +Subproject commit 62d7cad7290c7fe91908ed60e0501b96e4e74695 diff --git a/arm_compute/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h b/arm_compute/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h index 5ccf4e64ed..21d026e0a1 100644 --- a/arm_compute/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h +++ b/arm_compute/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -50,22 +50,20 @@ public: /** Initialise the kernel's input and output. * - * @param[in] input Source tensor. Data types supported: QASYMM8/F16/F32. - * @param[out] output Destination tensor. Data types supported: same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane. - * @param[in] inner_border Top and right inner border sizes. These rows and columns will be filled with zero. - * @param[in] info Contains padding and stride information described in @ref PadStrideInfo. + * @param[in] input Source tensor. Data types supported: QASYMM8/F16/F32. + * @param[out] output Destination tensor. Data types supported: same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane. + * @param[in] info Contains padding and stride information described in @ref PadStrideInfo. */ - void configure(const ICLTensor *input, ICLTensor *output, const BorderSize &inner_border, const PadStrideInfo &info); + void configure(const ICLTensor *input, ICLTensor *output, const PadStrideInfo &info); /** Static function to check if given info will lead to a valid configuration of @ref CLDeconvolutionLayerUpsample * - * @param[in] input Source tensor info. Data types supported: QASYMM8/F16/F32. - * @param[in] output Destination tensor info. Data types supported: same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane. - * @param[in] inner_border Top and right inner border sizes. These rows and columns will be filled with zero. - * @param[in] info Contains padding and stride information described in @ref PadStrideInfo. + * @param[in] input Source tensor info. Data types supported: QASYMM8/F16/F32. + * @param[in] output Destination tensor info. Data types supported: same as @p input. All but the lowest two dimensions must be the same size as in the input tensor, i.e. scaling is only performed within the XY-plane. + * @param[in] info Contains padding and stride information described in @ref PadStrideInfo. * * @return a status */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, const BorderSize &inner_border, const PadStrideInfo &info); + static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info); // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; @@ -73,7 +71,6 @@ public: private: const ICLTensor *_input; ICLTensor *_output; - BorderSize _inner_border; PadStrideInfo _info; }; } // namespace arm_compute diff --git a/arm_compute/core/CPP/kernels/CPPUpsampleKernel.h b/arm_compute/core/CPP/kernels/CPPUpsampleKernel.h index fedbb54d35..571debe1b3 100644 --- a/arm_compute/core/CPP/kernels/CPPUpsampleKernel.h +++ b/arm_compute/core/CPP/kernels/CPPUpsampleKernel.h @@ -55,13 +55,11 @@ public: /** Set the input and output of the kernel. * - * @param[in] input The input tensor to upsample. Data types supported: F32/F16/QASYMM8 - * @param[out] output The output tensor. Data types supported: Same as @p input - * @param[in] info Padding info. - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. + * @param[in] input The input tensor to upsample. Data types supported: F32/F16/QASYMM8 + * @param[out] output The output tensor. Data types supported: Same as @p input + * @param[in] info Padding info. */ - void configure(const ITensor *input, ITensor *output, const PadStrideInfo &info, unsigned int inner_border_right, unsigned int inner_border_top); + void configure(const ITensor *input, ITensor *output, const PadStrideInfo &info); // Inherited methods overridden: void run(const Window &window, const ThreadInfo &info) override; @@ -71,7 +69,6 @@ private: const ITensor *_input; ITensor *_output; PadStrideInfo _info; - std::pair _inner_border; }; } // namespace arm_compute #endif /*__ARM_COMPUTE_CPPUPSAMPLEKERNEL_H__ */ diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index 010501454f..65a2a1edf4 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -438,20 +438,17 @@ inline TensorShape compute_depthwise_convolution_shape(const ITensorInfo &input, /** Calculate the upsampled output shape used for deconvolution * - * @param[in] input Input tensor info - * @param[in] weights Weights tensor shape - * @param[in] sx Stride on x axis - * @param[in] sy Stride on y axis - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. - * @param[in] out_dims Output shape dimensions - * @param[in] padx Padding on x axis - * @param[in] pady Padding on y axis + * @param[in] input Input tensor info + * @param[in] weights Weights tensor shape + * @param[in] sx Stride on x axis + * @param[in] sy Stride on y axis + * @param[in] out_dims Output shape dimensions + * @param[in] padx Padding on x axis + * @param[in] pady Padding on y axis * * @return the calculated shape */ -inline TensorShape compute_deconvolution_upsampled_shape(const ITensorInfo &input, const ITensorInfo &weights, unsigned int sx, unsigned int sy, unsigned int inner_border_right, - unsigned int inner_border_top, +inline TensorShape compute_deconvolution_upsampled_shape(const ITensorInfo &input, const ITensorInfo &weights, unsigned int sx, unsigned int sy, std::pair &out_dims, unsigned int &padx, unsigned int &pady) { const DataLayout data_layout = input.data_layout(); @@ -459,8 +456,8 @@ inline TensorShape compute_deconvolution_upsampled_shape(const ITensorInfo &inpu const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); // Find the upsampled dimensions - unsigned int out_x = (input.dimension(idx_w) - 1) * sx + inner_border_right + 1; - unsigned int out_y = (input.dimension(idx_h) - 1) * sy + inner_border_top + 1; + unsigned int out_x = (input.dimension(idx_w) - 1) * sx + 1; + unsigned int out_y = (input.dimension(idx_h) - 1) * sy + 1; // Find the padding needed for the convolution with stride 1 in order to match output shape padx = out_dims.first - (out_x - weights.dimension(idx_w) + 1); diff --git a/arm_compute/graph/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h index 0aaed1da7d..e1049ca938 100644 --- a/arm_compute/graph/GraphBuilder.h +++ b/arm_compute/graph/GraphBuilder.h @@ -155,14 +155,13 @@ public: * @param[in] kernel_spatial_extend Spatial extend of convolution kernels * @param[in] depth Number of convolution kernels * @param[in] deconv_info Convolution layer information - * @param[in] inner_border Inner border (right, top) * @param[in] weights_accessor (Optional) Accessor of the weights node data * @param[in] bias_accessor (Optional) Accessor of the bias node data * * @return Node ID of the created node, EmptyNodeID in case of error */ static NodeID add_deconvolution_node(Graph &g, NodeParams params, NodeIdxPair input, - Size2D kernel_spatial_extend, unsigned int depth, PadStrideInfo deconv_info, Size2D inner_border, + Size2D kernel_spatial_extend, unsigned int depth, PadStrideInfo deconv_info, ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr); /** Adds a depth concatenate node to the graph * diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h index fbf8d17f67..5ac4fdaed9 100644 --- a/arm_compute/graph/backends/FunctionHelpers.h +++ b/arm_compute/graph/backends/FunctionHelpers.h @@ -462,8 +462,7 @@ std::unique_ptr create_deconvolution_layer(DeconvolutionLayerNode &no typename TargetInfo::TensorType *biases = get_backing_tensor(node.input(2)); typename TargetInfo::TensorType *output = get_backing_tensor(node.output(0)); - const PadStrideInfo deconv_info = node.deconvolution_info(); - const Size2D inner_border = node.inner_border(); + const PadStrideInfo deconv_info = node.deconvolution_info(); // Create and configure function (we assume that functions have been validated before creation) std::shared_ptr mm = get_memory_manager(ctx, TargetInfo::TargetType); @@ -471,7 +470,7 @@ std::unique_ptr create_deconvolution_layer(DeconvolutionLayerNode &no std::tie(func, std::ignore) = create_named_memory_managed_function( std::string(), mm, - input, weights, biases, output, deconv_info, inner_border.x(), inner_border.y()); + input, weights, biases, output, deconv_info); // Log info ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " diff --git a/arm_compute/graph/frontend/Layers.h b/arm_compute/graph/frontend/Layers.h index f73b1f49d9..3fc4af46d5 100644 --- a/arm_compute/graph/frontend/Layers.h +++ b/arm_compute/graph/frontend/Layers.h @@ -370,26 +370,23 @@ class DeconvolutionLayer final : public ILayer public: /** Construct a convolution layer. * - * @param[in] conv_width Convolution width. - * @param[in] conv_height Convolution height. - * @param[in] ofm Output feature map. - * @param[in] weights Accessor to get kernel weights from. - * @param[in] bias Accessor to get kernel bias from. - * @param[in] deconv_info Padding and stride information. - * @param[in] inner_border Inner border padding (right, top) + * @param[in] conv_width Convolution width. + * @param[in] conv_height Convolution height. + * @param[in] ofm Output feature map. + * @param[in] weights Accessor to get kernel weights from. + * @param[in] bias Accessor to get kernel bias from. + * @param[in] deconv_info Padding and stride information. */ DeconvolutionLayer(unsigned int conv_width, unsigned int conv_height, unsigned int ofm, ITensorAccessorUPtr weights, ITensorAccessorUPtr bias, - PadStrideInfo deconv_info, - Size2D inner_border) + PadStrideInfo deconv_info) : _conv_width(conv_width), _conv_height(conv_height), _ofm(ofm), _deconv_info(std::move(deconv_info)), - _inner_border(inner_border), _weights(std::move(weights)), _bias(std::move(bias)) { @@ -400,7 +397,7 @@ public: NodeIdxPair input = { s.tail_node(), 0 }; NodeParams common_params = { name(), s.hints().target_hint }; return GraphBuilder::add_deconvolution_node(s.graph(), common_params, input, - Size2D(_conv_width, _conv_height), _ofm, _deconv_info, _inner_border, + Size2D(_conv_width, _conv_height), _ofm, _deconv_info, std::move(_weights), std::move(_bias)); } @@ -409,7 +406,6 @@ private: unsigned int _conv_height; unsigned int _ofm; const PadStrideInfo _deconv_info; - Size2D _inner_border; ITensorAccessorUPtr _weights; ITensorAccessorUPtr _bias; }; diff --git a/arm_compute/graph/nodes/DeconvolutionLayerNode.h b/arm_compute/graph/nodes/DeconvolutionLayerNode.h index 19501482c6..e6869d7aae 100644 --- a/arm_compute/graph/nodes/DeconvolutionLayerNode.h +++ b/arm_compute/graph/nodes/DeconvolutionLayerNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -36,20 +36,14 @@ class DeconvolutionLayerNode final : public INode public: /** Constructor * - * @param[in] info DeConvolution layer attributes - * @param[in] inner_border Inner border (right, top) + * @param[in] info DeConvolution layer attributes */ - DeconvolutionLayerNode(PadStrideInfo info, Size2D inner_border); + DeconvolutionLayerNode(PadStrideInfo info); /** Deconvolution metadata accessor * * @return Deconvolution information */ PadStrideInfo deconvolution_info() const; - /** Deconvolution inner border accessor - * - * @return Inner border(top, right) - */ - Size2D inner_border() const; /** Computes deconvolution output descriptor * * @param[in] input_descriptor Input descriptor @@ -70,7 +64,6 @@ public: private: PadStrideInfo _info; - Size2D _inner_border; }; } // namespace graph } // namespace arm_compute diff --git a/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h index e5b406ee5e..b722b466f0 100644 --- a/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h +++ b/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h @@ -44,40 +44,6 @@ public: /** Default constructor */ CLDeconvolutionLayer(std::shared_ptr memory_manager = nullptr); - /** Set the input, weights, biases and output tensors. - * - * @note This method will be deprecated in the next release. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Same as @p input. - * @param[out] output Output tensor. The output has the same number of dimensions as the @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, this is described in @ref PadStrideInfo. - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - */ - void 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 = WeightsInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref CLDeconvolutionLayer - * - * @note This method will be deprecated in the next release. - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: QASYMM8/F16/F32. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Same as @p input. - * @param[in] output Output tensor info. The output has the same number of dimensions as the @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, this is described in @ref PadStrideInfo. - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - * @return a status - */ - static Status 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 = WeightsInfo()); - /** Set the input, weights, biases and output tensors. * * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: QASYMM8/F16/F32. diff --git a/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h b/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h index 3751178703..cab252f0ea 100644 --- a/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h +++ b/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h @@ -61,24 +61,20 @@ public: /** Initialize the function's source, destination, interpolation type and border_mode. * - * @param[in, out] input Source tensor. Data type supported: QASYMM8/F16/F32. - * @param[out] output Destination tensor. Data type supported: same as @p input. - * @param[in] inner_border The number of zeros added to right and top edges of the input. - * @param[in] info Contains padding and policies to be used in the deconvolution. + * @param[in, out] input Source tensor. Data type supported: QASYMM8/F16/F32. + * @param[out] output Destination tensor. Data type supported: same as @p input. + * @param[in] info Contains padding and policies to be used in the deconvolution. */ - void configure(ICLTensor *input, ICLTensor *output, const BorderSize &inner_border, - const PadStrideInfo &info); + void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info); /** Static function to check if given info will lead to a valid configuration of @ref CLDeconvolutionLayerUpsample * - * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. - * @param[in] output Destination tensor info. Data type supported: same as @p input. - * @param[in] inner_border The number of zeros added to right and top edges of the input. - * @param[in] info Contains padding and policies to be used in the deconvolution. + * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. + * @param[in] output Destination tensor info. Data type supported: same as @p input. + * @param[in] info Contains padding and policies to be used in the deconvolution. * * @return a status */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, const BorderSize &inner_border, - const PadStrideInfo &info); + static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info); // Inherited methods overridden: void run() override; diff --git a/arm_compute/runtime/CPP/functions/CPPUpsample.h b/arm_compute/runtime/CPP/functions/CPPUpsample.h index fd7d9c24bf..13f8755762 100644 --- a/arm_compute/runtime/CPP/functions/CPPUpsample.h +++ b/arm_compute/runtime/CPP/functions/CPPUpsample.h @@ -38,13 +38,11 @@ class CPPUpsample : public ICPPSimpleFunction public: /** Configure the upsample CPP kernel * - * @param[in] input The input tensor to upsample. Data types supported: F32/F16/QASYMM8 - * @param[out] output The output tensor. Data types supported: Same as @p input - * @param[in] info Padding information - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. + * @param[in] input The input tensor to upsample. Data types supported: F32/F16/QASYMM8 + * @param[out] output The output tensor. Data types supported: Same as @p input + * @param[in] info Padding information */ - void configure(const ITensor *input, ITensor *output, const PadStrideInfo &info, unsigned int inner_border_right, unsigned int inner_border_top); + void configure(const ITensor *input, ITensor *output, const PadStrideInfo &info); }; } #endif /* __ARM_COMPUTE_CPPUPSAMPLE_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEDeconvolutionLayer.h b/arm_compute/runtime/NEON/functions/NEDeconvolutionLayer.h index 4eb684b9aa..62977a7647 100644 --- a/arm_compute/runtime/NEON/functions/NEDeconvolutionLayer.h +++ b/arm_compute/runtime/NEON/functions/NEDeconvolutionLayer.h @@ -86,37 +86,6 @@ public: NEDeconvolutionLayer &operator=(NEDeconvolutionLayer &&) = default; /** Default destructor */ virtual ~NEDeconvolutionLayer() = default; - /** Set the input, weights, biases and output tensors. - * - * @note This method will be deprecated in the next release. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: F32/F16/QASYMM8. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type supported: Same as @p input. - * @param[in] bias Optional, ignored if NULL. The biases have one dimension. Data type supported: Data types supported: S32 for QASYMM8 input, F32 for F32 input, F16 for F16 input. - * @param[out] output Output tensor. The output has the same number of dimensions as the @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this is decribed in @ref PadStrideInfo. - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. - * - */ - void configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &info, - unsigned int inner_border_right, unsigned int inner_border_top); - /** Static function to check if given info will lead to a valid configuration of @ref NEDeconvolutionLayer - * - * @note This method will be deprecated in the next release. - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: F32/F16/QASYMM8. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Data types supported: S32 for QASYMM8 input, F32 for F32 input, F16 for F16 input. - * @param[in] output Output tensor info. The output has the same number of dimensions as the @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this is decribed in @ref PadStrideInfo. - * @param[in] inner_border_right The number of zeros added to right edge of the input. - * @param[in] inner_border_top The number of zeros added to top edge of the input. - * - * @return a status - */ - static Status 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); /** Set the input, weights, biases and output tensors. * @@ -154,8 +123,7 @@ private: const ITensor *_original_weights; ITensor *_input; PadStrideInfo _info; - std::pair _inner_border; - bool _is_prepared; + bool _is_prepared; }; } // arm_compute #endif /* __ARM_COMPUTE_NEDECONVOLUTIONLAYER_H__ */ diff --git a/docs/00_introduction.dox b/docs/00_introduction.dox index f216519e58..29f28894b0 100644 --- a/docs/00_introduction.dox +++ b/docs/00_introduction.dox @@ -242,6 +242,8 @@ v19.08 Public major release - Deprecated functions/interfaces - Altered @ref QuantizationInfo interface to support per-channel quantization. - The @ref NEDepthwiseConvolutionLayer3x3 will be replaced by @ref NEDepthwiseConvolutionLayerOptimized to accommodate for future optimizations. + - Removed inner_border_right and inner_border_top parameters from @ref CLDeconvolutionLayer interface + - Removed inner_border_right and inner_border_top parameters from @ref NEDeconvolutionLayer interface v19.05 Public major release - Various bug fixes. diff --git a/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp b/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp index 70337be13d..295fb5c997 100644 --- a/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp +++ b/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp @@ -35,11 +35,11 @@ using namespace arm_compute; CLDeconvolutionLayerUpsampleKernel::CLDeconvolutionLayerUpsampleKernel() - : _input(nullptr), _output(nullptr), _inner_border(), _info() + : _input(nullptr), _output(nullptr), _info() { } -Status CLDeconvolutionLayerUpsampleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const BorderSize &inner_border, +Status CLDeconvolutionLayerUpsampleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); @@ -64,24 +64,20 @@ Status CLDeconvolutionLayerUpsampleKernel::validate(const ITensorInfo *input, co ARM_COMPUTE_RETURN_ERROR_ON(input->dimension(i) != output->dimension(i)); } - ARM_COMPUTE_RETURN_ERROR_ON_MSG(inner_border.right > info.stride().first - 1, "inner_border_right must be smaller that stride_x"); - ARM_COMPUTE_RETURN_ERROR_ON_MSG(inner_border.top > info.stride().second - 1, "inner_border_top must be smaller that stride_y"); - return Status{}; } -void CLDeconvolutionLayerUpsampleKernel::configure(const ICLTensor *input, ICLTensor *output, const BorderSize &inner_border, +void CLDeconvolutionLayerUpsampleKernel::configure(const ICLTensor *input, ICLTensor *output, const PadStrideInfo &info) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); - _input = input; - _output = output; - _inner_border = inner_border; - _info = info; + _input = input; + _output = output; + _info = info; // Perform validation step - ARM_COMPUTE_ERROR_THROW_ON(CLDeconvolutionLayerUpsampleKernel::validate(input->info(), output->info(), inner_border, info)); + ARM_COMPUTE_ERROR_THROW_ON(CLDeconvolutionLayerUpsampleKernel::validate(input->info(), output->info(), info)); // Create kernel CLBuildOptions build_opts; @@ -109,10 +105,10 @@ void CLDeconvolutionLayerUpsampleKernel::run(const Window &window, cl::CommandQu const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); const int out_start_x = _info.pad().first; - const int out_end_x = _output->info()->dimension(idx_w) - _inner_border.right - _info.pad().first + _info.stride().first - 1; + const int out_end_x = _output->info()->dimension(idx_w) - _info.pad().first + _info.stride().first - 1; const int out_step_x = _info.stride().first; - const int out_start_y = _inner_border.top + _info.pad().second; + const int out_start_y = _info.pad().second; const int out_end_y = _output->info()->dimension(idx_h) - _info.pad().second + _info.stride().second - 1; const int out_step_y = _info.stride().second; diff --git a/src/core/CPP/kernels/CPPUpsampleKernel.cpp b/src/core/CPP/kernels/CPPUpsampleKernel.cpp index d29c0f72f1..6620ce2aeb 100644 --- a/src/core/CPP/kernels/CPPUpsampleKernel.cpp +++ b/src/core/CPP/kernels/CPPUpsampleKernel.cpp @@ -37,7 +37,7 @@ using namespace arm_compute; CPPUpsampleKernel::CPPUpsampleKernel() - : _input(nullptr), _output(nullptr), _info(), _inner_border() + : _input(nullptr), _output(nullptr), _info() { } @@ -46,14 +46,13 @@ bool CPPUpsampleKernel::is_parallelisable() const return false; } -void CPPUpsampleKernel::configure(const ITensor *input, ITensor *output, const PadStrideInfo &info, unsigned int inner_border_right, unsigned int inner_border_top) +void CPPUpsampleKernel::configure(const ITensor *input, ITensor *output, const PadStrideInfo &info) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); - _input = input; - _output = output; - _info = info; - _inner_border = std::make_pair(inner_border_right, inner_border_top); + _input = input; + _output = output; + _info = info; // Configure kernel window Window win = calculate_max_window(*input->info(), Steps()); @@ -78,9 +77,9 @@ void CPPUpsampleKernel::run(const Window &window, const ThreadInfo &info) const int stride_x = _info.stride().first; const int stride_y = _info.stride().second; const int start_x = _info.pad().first; - const int start_y = _inner_border.second + _info.pad().second; + const int start_y = _info.pad().second; const int end_y = height_scaled - _info.pad().second; - const int end_x = width_scaled - _inner_border.first - _info.pad().first; + const int end_x = width_scaled - _info.pad().first; const size_t element_size = _input->info()->element_size(); std::fill_n(_output->buffer(), _output->info()->total_size(), 0); diff --git a/src/graph/GraphBuilder.cpp b/src/graph/GraphBuilder.cpp index 68385aa30c..54bd066712 100644 --- a/src/graph/GraphBuilder.cpp +++ b/src/graph/GraphBuilder.cpp @@ -269,7 +269,7 @@ NodeID GraphBuilder::add_convolution_node(Graph &g, NodeParams params, NodeIdxPa NodeID GraphBuilder::add_deconvolution_node(Graph &g, NodeParams params, NodeIdxPair input, Size2D kernel_spatial_extend, unsigned int depth, PadStrideInfo deconv_info, - Size2D inner_border, ITensorAccessorUPtr weights_accessor, + ITensorAccessorUPtr weights_accessor, ITensorAccessorUPtr bias_accessor) { check_nodeidx_pair(input, g); @@ -306,7 +306,7 @@ NodeID GraphBuilder::add_deconvolution_node(Graph &g, NodeParams params, NodeIdx } // Create convolution node and connect - NodeID deconv_nid = g.add_node(deconv_info, inner_border); + NodeID deconv_nid = g.add_node(deconv_info); g.add_connection(input.node_id, input.index, deconv_nid, 0); g.add_connection(w_nid, 0, deconv_nid, 1); if(has_bias) diff --git a/src/graph/nodes/DeconvolutionLayerNode.cpp b/src/graph/nodes/DeconvolutionLayerNode.cpp index b1a6db7ccc..28c75297a5 100644 --- a/src/graph/nodes/DeconvolutionLayerNode.cpp +++ b/src/graph/nodes/DeconvolutionLayerNode.cpp @@ -32,8 +32,8 @@ namespace arm_compute { namespace graph { -DeconvolutionLayerNode::DeconvolutionLayerNode(PadStrideInfo info, Size2D inner_border) - : _info(std::move(info)), _inner_border(inner_border) +DeconvolutionLayerNode::DeconvolutionLayerNode(PadStrideInfo info) + : _info(std::move(info)) { _input_edges.resize(3, EmptyEdgeID); _outputs.resize(1, NullTensorID); @@ -44,11 +44,6 @@ PadStrideInfo DeconvolutionLayerNode::deconvolution_info() const return _info; } -Size2D DeconvolutionLayerNode::inner_border() const -{ - return _inner_border; -} - TensorDescriptor DeconvolutionLayerNode::compute_output_descriptor(const TensorDescriptor &input_descriptor, const TensorDescriptor &weights_descriptor, const PadStrideInfo &info) @@ -109,4 +104,4 @@ void DeconvolutionLayerNode::accept(INodeVisitor &v) v.visit(*this); } } // namespace graph -} // namespace arm_compute \ No newline at end of file +} // namespace arm_compute 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 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(); - 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 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 diff --git a/tests/validation/CL/DeconvolutionLayer.cpp b/tests/validation/CL/DeconvolutionLayer.cpp index db93bebde1..f8a677cb34 100644 --- a/tests/validation/CL/DeconvolutionLayer.cpp +++ b/tests/validation/CL/DeconvolutionLayer.cpp @@ -72,60 +72,46 @@ TEST_SUITE(DeconvolutionLayer) // *INDENT-OFF* // clang-format off -DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( +DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip( framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights shape + TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), // Non supported data type TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid bias shape TensorInfo(TensorShape(13U, 11U, 4U, 3U), 1, DataType::F32), // Window shrink - TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Inner border different from 0 TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), }), framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16), TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), + TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16), TensorInfo(TensorShape(3U, 2U, 2U, 2U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 4U), 1, DataType::F32), - TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32), TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32), })), framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(1U), 1, DataType::F16), + TensorInfo(TensorShape(1U), 1, DataType::F32), TensorInfo(TensorShape(1U), 1, DataType::F32), TensorInfo(TensorShape(25U, 11U), 1, DataType::F32), TensorInfo(TensorShape(1U), 1, DataType::F32), TensorInfo(TensorShape(4U), 1, DataType::F32), - TensorInfo(TensorShape(4U), 1, DataType::S32), - TensorInfo(TensorShape(4U), 1, DataType::S32), })), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16), TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32), + TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), TensorInfo(TensorShape(13U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(11U, 9U, 1U, 3U), 1, DataType::F32), TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32), })), framework::dataset::make("PadStrideInfo", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(1, 1, 0, 0), PadStrideInfo(1, 1, 0, 0), - PadStrideInfo(1, 1, 1, 1), PadStrideInfo(1, 1, 0, 0), + PadStrideInfo(1, 1, 1, 1), PadStrideInfo(1, 1, 0, 0), })), - framework::dataset::make("ax", { 0U, - 0U, - 0U, - 0U, - 0U, - })), - framework::dataset::make("ay", { 0U, - 0U, - 0U, - 0U, - 1U, - 0U, - })), - framework::dataset::make("Expected", { false, false, false, false, true, true })), - input_info, weights_info, bias_info, output_info, pad_info, ax, ay, expected) + framework::dataset::make("Expected", { false, false, false, false, false, true })), + input_info, weights_info, bias_info, output_info, pad_info, expected) { - bool is_valid = bool(CLDeconvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pad_info, ax, ay)); + bool is_valid = bool(CLDeconvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pad_info)); ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); } // clang-format on diff --git a/tests/validation/NEON/DeconvolutionLayer.cpp b/tests/validation/NEON/DeconvolutionLayer.cpp index 8860a9f974..4d0ce63089 100644 --- a/tests/validation/NEON/DeconvolutionLayer.cpp +++ b/tests/validation/NEON/DeconvolutionLayer.cpp @@ -46,9 +46,9 @@ namespace constexpr AbsoluteTolerance tolerance_fp32(0.001f); /**< Tolerance for floating point tests */ constexpr AbsoluteTolerance tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */ #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC -const RelativeTolerance tolerance_fp16(half_float::half(0.2f)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F16 */ -#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC*/ -constexpr float tolerance_num = 0.07f; /**< Tolerance number */ +const RelativeTolerance tolerance_fp16(half_float::half(0.2f)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F16 */ +#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC*/ +constexpr float tolerance_num = 0.07f; /**< Tolerance number */ const auto data4x4 = datasets::SmallDeconvolutionShapes() * framework::dataset::make("StrideX", 1, 4) * framework::dataset::make("StrideY", 1, 4) * framework::dataset::make("PadX", 0, 3) * framework::dataset::make("PadY", 0, 3) * framework::dataset::make("NumKernels", { 3 }); @@ -93,7 +93,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, (combine(datasets::Sm // Create and configure function NEDeconvolutionLayer deconv; - deconv.configure(&src, &weights, &bias, &dst, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL), 0, 0); + deconv.configure(&src, &weights, &bias, &dst, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL)); // Validate valid region const ValidRegion src_valid_region = shape_to_valid_region(input_shape); @@ -109,7 +109,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, (combine(datasets::Sm // *INDENT-OFF* // clang-format off -DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( +DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip( framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights shape TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), // Non supported data type @@ -145,24 +145,10 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zi PadStrideInfo(1, 1, 1, 1), PadStrideInfo(1, 1, 0, 0), })), - framework::dataset::make("ax", { 1U, - 1U, - 1U, - 1U, - 0U, - 0U, - })), - framework::dataset::make("ay", { 1U, - 1U, - 1U, - 1U, - 0U, - 0U, - })), framework::dataset::make("Expected", { false, false, false, false, false, true })), - input_info, weights_info, bias_info, output_info, pad_info, ax, ay, expected) + input_info, weights_info, bias_info, output_info, pad_info, expected) { - bool is_valid = bool(NEDeconvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pad_info, ax, ay)); + bool is_valid = bool(NEDeconvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pad_info)); ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); } // clang-format on @@ -215,7 +201,7 @@ TEST_SUITE_END() // FP32 TEST_SUITE(FP16) TEST_SUITE(W4x4) FIXTURE_DATA_TEST_CASE(Run, NEDeconvolutionLayerFixture4x4, framework::DatasetMode::NIGHTLY, combine(combine(data4x4, framework::dataset::make("DataType", DataType::F16)), - data_layouts_dataset)) + data_layouts_dataset)) { // Validate output validate(Accessor(_target), _reference, tolerance_fp16); @@ -223,13 +209,13 @@ FIXTURE_DATA_TEST_CASE(Run, NEDeconvolutionLayerFixture4x4, framework::Dat TEST_SUITE_END() // W4x4 TEST_SUITE(W3x3) FIXTURE_DATA_TEST_CASE(RunSmall, NEDeconvolutionLayerFixture3x3, framework::DatasetMode::PRECOMMIT, combine(combine(data3x3_precommit, framework::dataset::make("DataType", DataType::F16)), - data_layouts_dataset)) + data_layouts_dataset)) { // Validate output validate(Accessor(_target), _reference, tolerance_fp16); } FIXTURE_DATA_TEST_CASE(RunLarge, NEDeconvolutionLayerFixture3x3, framework::DatasetMode::NIGHTLY, combine(combine(data3x3, framework::dataset::make("DataType", DataType::F16)), - data_layouts_dataset)) + data_layouts_dataset)) { // Validate output validate(Accessor(_target), _reference, tolerance_fp16); @@ -237,7 +223,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, NEDeconvolutionLayerFixture3x3, framework TEST_SUITE_END() // W3x3 TEST_SUITE(W1x1) FIXTURE_DATA_TEST_CASE(Run, NEDeconvolutionLayerFixture1x1, framework::DatasetMode::NIGHTLY, combine(combine(data1x1, framework::dataset::make("DataType", DataType::F16)), - data_layouts_dataset)) + data_layouts_dataset)) { // Validate output validate(Accessor(_target), _reference, tolerance_fp16); @@ -246,7 +232,6 @@ TEST_SUITE_END() // W1x1 TEST_SUITE_END() // FP16 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ - TEST_SUITE_END() // Float template -- cgit v1.2.1