From 70ba7d670474d68d2894ffbbe68ea9456f3597ee Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Wed, 6 Jun 2018 17:03:36 +0100 Subject: COMPMID-1257: Allow retaining weights in CLDeconvolutionLayer Change-Id: I8c430f2efafa0f47e2b12e388713ba693a6df8ee Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/134467 Tested-by: Jenkins Reviewed-by: Michalis Spyrou --- arm_compute/runtime/CL/functions/CLConvolutionLayer.h | 4 ++-- arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h | 8 +++++--- src/runtime/CL/functions/CLDeconvolutionLayer.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arm_compute/runtime/CL/functions/CLConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLConvolutionLayer.h index 97998b5595..82bb71ca6c 100644 --- a/arm_compute/runtime/CL/functions/CLConvolutionLayer.h +++ b/arm_compute/runtime/CL/functions/CLConvolutionLayer.h @@ -74,7 +74,7 @@ public: * @param[in] output Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. * Data types supported: Same as @p input. * @param[in] conv_info Contains padding and stride information described in @ref PadStrideInfo. - * @param[in] weights_info Specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. Data type supported: Same as @p input. + * @param[in] weights_info Specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1). * @param[in] act_info (Optional) Activation layer information in case of a fused activation. * @param[in] enable_fast_math (Optional) Enable fast math computation. In case this flag were set, the function could dispatch the fastest implementation @@ -93,7 +93,7 @@ public: * @param[in] output Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. * Data types supported: Same as @p input. * @param[in] conv_info Contains padding and stride information described in @ref PadStrideInfo. - * @param[in] weights_info Specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. Data type supported: Same as @p input. + * @param[in] weights_info Specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. * @param[in] act_info (Optional) Activation layer information in case of a fused activation. * @param[in] gpu_target Specifies the @p GPUTarget. * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1). diff --git a/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h index f29039a97c..82969301b0 100644 --- a/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h +++ b/arm_compute/runtime/CL/functions/CLDeconvolutionLayer.h @@ -71,10 +71,11 @@ public: * @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. + * @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, const ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, - unsigned int inner_border_right, unsigned int inner_border_top); + 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 * * @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: F16/F32. @@ -84,11 +85,12 @@ public: * @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. + * @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 &info, - unsigned int inner_border_right, unsigned int inner_border_top); + unsigned int inner_border_right, unsigned int inner_border_top, const WeightsInfo &weights_info = WeightsInfo()); // Inherited methods overridden: void run() override; @@ -100,4 +102,4 @@ private: CLTensor _scaled_output; }; } -#endif /* __ARM_COMPUTE_CLDECONVOLUTIONLAYER_H__ */ \ No newline at end of file +#endif /* __ARM_COMPUTE_CLDECONVOLUTIONLAYER_H__ */ diff --git a/src/runtime/CL/functions/CLDeconvolutionLayer.cpp b/src/runtime/CL/functions/CLDeconvolutionLayer.cpp index 4d971f3c72..6c54b18b81 100644 --- a/src/runtime/CL/functions/CLDeconvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLDeconvolutionLayer.cpp @@ -43,7 +43,7 @@ CLDeconvolutionLayer::CLDeconvolutionLayer(std::shared_ptr memor } Status CLDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &info, - unsigned int inner_border_right, unsigned int inner_border_top) + unsigned int inner_border_right, unsigned int inner_border_top, const WeightsInfo &weights_info) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, weights, output); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16, DataType::F32); @@ -80,13 +80,13 @@ Status CLDeconvolutionLayer::validate(const ITensorInfo *input, const ITensorInf const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL); ARM_COMPUTE_RETURN_ON_ERROR(CLDeconvolutionLayerUpsample::validate(input, &scale_out_info, BorderSize(inner_border_right, inner_border_top), info)); - ARM_COMPUTE_RETURN_ON_ERROR(CLConvolutionLayer::validate(&scale_out_info, weights, bias, output, conv_info, WeightsInfo())); + ARM_COMPUTE_RETURN_ON_ERROR(CLConvolutionLayer::validate(&scale_out_info, weights, bias, output, conv_info, weights_info)); return Status{}; } void CLDeconvolutionLayer::configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, - unsigned int inner_border_right, unsigned int inner_border_top) + unsigned int inner_border_right, unsigned int inner_border_top, const WeightsInfo &weights_info) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output); @@ -120,7 +120,7 @@ void CLDeconvolutionLayer::configure(ICLTensor *input, const ICLTensor *weights, // 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); + _conv_f.configure(&_scaled_output, weights, bias, output, conv_info, weights_info); _scaled_output.allocator()->allocate(); } -- cgit v1.2.1