From a66eaa2a374a50b798159d95431c946fdda22a24 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Thu, 21 Dec 2017 19:50:06 +0000 Subject: COMPMID-752 Creating an example for QASYMM8 MobileNet Change-Id: Ic76b3b6adaff8c84ba4d2ca5283d9291c69344f0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/114466 Tested-by: Jenkins Reviewed-by: Pablo Tello Reviewed-by: Georgios Pinitas --- arm_compute/graph/nodes/ConvolutionLayer.h | 56 ++++++++++++---------- .../graph/nodes/DepthwiseConvolutionLayer.h | 21 ++++---- 2 files changed, 44 insertions(+), 33 deletions(-) (limited to 'arm_compute/graph') diff --git a/arm_compute/graph/nodes/ConvolutionLayer.h b/arm_compute/graph/nodes/ConvolutionLayer.h index 0905524de8..1806190971 100644 --- a/arm_compute/graph/nodes/ConvolutionLayer.h +++ b/arm_compute/graph/nodes/ConvolutionLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,24 +44,28 @@ class ConvolutionLayer final : public INode public: /** Default Constructor * - * @param[in] conv_width Convolution width - * @param[in] conv_height Convolution height - * @param[in] ofm Output feature map - * @param[in] weights Weights of the convolution layer - * @param[in] biases Bias of the convolution layer - * @param[in] conv_info Convolution information - * @param[in] num_groups (Optional) Number of groups, default = 1 - * @param[in] weights_info (Optional) Weights information + * @param[in] conv_width Convolution width + * @param[in] conv_height Convolution height + * @param[in] ofm Output feature map + * @param[in] weights Weights of the convolution layer + * @param[in] biases Bias of the convolution layer + * @param[in] conv_info Convolution information + * @param[in] num_groups (Optional) Number of groups, default = 1 + * @param[in] weights_info (Optional) Weights information + * @param[in] weights_quant_info (Optional) Weights quantization information + * @param[in] out_quant_info (Optional) Output quantization info */ template - ConvolutionLayer(unsigned int conv_width, - unsigned int conv_height, - unsigned int ofm, + ConvolutionLayer(unsigned int conv_width, + unsigned int conv_height, + unsigned int ofm, AccessorTypeWeights &&weights, - AccessorTypeBiases &&biases, - const PadStrideInfo conv_info, - unsigned int num_groups = 1, - const WeightsInfo weights_info = WeightsInfo()) + AccessorTypeBiases &&biases, + const PadStrideInfo conv_info, + unsigned int num_groups = 1, + const WeightsInfo weights_info = WeightsInfo(), + const QuantizationInfo weights_quant_info = QuantizationInfo(), + const QuantizationInfo out_quant_info = QuantizationInfo()) : _conv_width(conv_width), _conv_height(conv_height), _ofm(ofm), @@ -70,6 +74,8 @@ public: _conv_info(std::move(conv_info)), _num_groups(num_groups), _weights_info(std::move(weights_info)), + _weights_quant_info(std::move(weights_quant_info)), + _out_quant_info(std::move(out_quant_info)), _is(nullptr), _os(nullptr), _ws(nullptr), @@ -101,14 +107,16 @@ private: std::unique_ptr instantiate_grouped_convolution(ITensor *input, ITensor *output, ConvolutionMethodHint conv_method_hint); private: - unsigned int _conv_width; /**< Convolution width */ - unsigned int _conv_height; /**< Convolution height */ - unsigned int _ofm; /**< Output feature maps */ - Tensor _weights; /**< Weights tensor */ - Tensor _biases; /**< Biases tensor */ - const PadStrideInfo _conv_info; /**< Convolution layer information */ - unsigned int _num_groups; /**< Number of groups */ - const WeightsInfo _weights_info; /**< Convolution layer weights information */ + unsigned int _conv_width; /**< Convolution width */ + unsigned int _conv_height; /**< Convolution height */ + unsigned int _ofm; /**< Output feature maps */ + Tensor _weights; /**< Weights tensor */ + Tensor _biases; /**< Biases tensor */ + const PadStrideInfo _conv_info; /**< Convolution layer information */ + unsigned int _num_groups; /**< Number of groups */ + const WeightsInfo _weights_info; /**< Convolution layer weights information */ + const QuantizationInfo _weights_quant_info; /**< Output quantization information */ + const QuantizationInfo _out_quant_info; /**< Output quantization information */ std::unique_ptr _is; /**< Input tensor sub-tensors used for grouped convolution */ std::unique_ptr _os; /**< Output tensor sub-tensors used for grouped convolution */ diff --git a/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h b/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h index 8b7e3b8296..2d4bd1e0c2 100644 --- a/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h +++ b/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -50,10 +50,12 @@ public: * @param[in] biases Biases values tensor * @param[in] conv_info Convolution info * @param[in] opt3x3 (Optional) If true executes DepthwiseConvolutionLayer3x3 + * @param[in] quant_info (Optional) Quantization info used for weights */ template - DepthwiseConvolutionLayer(unsigned int conv_width, unsigned int conv_height, AccessorType &&weights, AccessorType &&biases, const PadStrideInfo conv_info, bool opt3x3 = true) - : _conv_width(conv_width), _conv_height(conv_height), _weights(std::move(weights)), _biases(std::move(biases)), _conv_info(conv_info), _opt3x3(opt3x3) + DepthwiseConvolutionLayer(unsigned int conv_width, unsigned int conv_height, AccessorType &&weights, AccessorType &&biases, const PadStrideInfo conv_info, bool opt3x3 = true, + const QuantizationInfo quant_info = QuantizationInfo()) + : _conv_width(conv_width), _conv_height(conv_height), _weights(std::move(weights)), _biases(std::move(biases)), _conv_info(conv_info), _opt3x3(opt3x3), _quant_info(std::move(quant_info)) { } @@ -61,12 +63,13 @@ public: std::unique_ptr instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; private: - unsigned int _conv_width; - unsigned int _conv_height; - Tensor _weights; - Tensor _biases; - const PadStrideInfo _conv_info; - bool _opt3x3; + unsigned int _conv_width; + unsigned int _conv_height; + Tensor _weights; + Tensor _biases; + const PadStrideInfo _conv_info; + bool _opt3x3; + const QuantizationInfo _quant_info; }; } // namespace graph } // namespace arm_compute -- cgit v1.2.1