From 0ae5de9124a0094e656244ad2f807c084966fc04 Mon Sep 17 00:00:00 2001 From: Isabella Gottardi Date: Thu, 14 Mar 2019 10:32:11 +0000 Subject: COMPMID-1995: Prepare Graph to support different input/output quantization info - Added support for different input/output qinfo in ActivationLayer and DepthwiseConv - Added support for different input/output qinfo in ConcatenateLayer introducing ConcatDescriptor - Added reshape validate - Allow OutputLayer to return a specific connection index from the input - Not run Inplace and Depth mutator when input/output quantization info are different Change-Id: I03f5e416fc43ddd284e1501887202a3145f76d8a Signed-off-by: Isabella Gottardi Reviewed-on: https://review.mlplatform.org/c/852 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Reviewed-by: Georgios Pinitas --- arm_compute/graph/GraphBuilder.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'arm_compute/graph/GraphBuilder.h') diff --git a/arm_compute/graph/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h index a2a938b1cc..590e4d9b44 100644 --- a/arm_compute/graph/GraphBuilder.h +++ b/arm_compute/graph/GraphBuilder.h @@ -25,6 +25,7 @@ #define __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__ #include "arm_compute/graph/ITensorAccessor.h" +#include "arm_compute/graph/LayerDescriptors.h" #include "arm_compute/graph/Types.h" namespace arm_compute @@ -73,14 +74,16 @@ public: static NodeID add_output_node(Graph &g, NodeParams params, NodeIdxPair input, ITensorAccessorUPtr accessor = nullptr); /** Adds an activation layer node to the graph * - * @param[in] g Graph to add the node to - * @param[in] params Common node parameters - * @param[in] input Input to the activation layer node as a NodeID-Index pair - * @param[in] act_info Activation layer information + * @param[in] g Graph to add the node to + * @param[in] params Common node parameters + * @param[in] input Input to the activation layer node as a NodeID-Index pair + * @param[in] act_info Activation layer information + * @param[in] out_quant_info (Optional) Output quantization info * * @return Node ID of the created node, EmptyNodeID in case of error */ - static NodeID add_activation_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info); + static NodeID add_activation_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info, + const QuantizationInfo out_quant_info = QuantizationInfo()); /** Adds a batch normalization layer node to the graph * * @param[in] g Graph to add the node to @@ -163,14 +166,14 @@ public: ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr); /** Adds a depth concatenate node to the graph * - * @param[in] g Graph to add the node to - * @param[in] params Common node parameters - * @param[in] inputs Inputs to the depth concatenate layer node as a NodeID-Index pair - * @param[in] axis Concatenation axis + * @param[in] g Graph to add the node to + * @param[in] params Common node parameters + * @param[in] inputs Inputs to the depth concatenate layer node as a NodeID-Index pair + * @param[in] concat_descriptor Concatenation layer descriptor * * @return Node ID of the created node, EmptyNodeID in case of error */ - static NodeID add_concatenate_node(Graph &g, NodeParams params, std::vector inputs, DataLayoutDimension axis); + static NodeID add_concatenate_node(Graph &g, NodeParams params, std::vector inputs, descriptors::ConcatLayerDescriptor concat_descriptor); /** Adds a depth-wise convolution layer node to the graph * * @param[in] g Graph to add the node to @@ -183,13 +186,15 @@ public: * @param[in] weights_accessor (Optional) Accessor of the weights node data * @param[in] bias_accessor (Optional) Accessor of the bias node data * @param[in] quant_info (Optional) Weights quantization info + * @param[in] out_quant_info (Optional) Output quantization info * * @return Node ID of the created node, EmptyNodeID in case of error */ static NodeID add_depthwise_convolution_node(Graph &g, NodeParams params, NodeIdxPair input, Size2D kernel_spatial_extend, PadStrideInfo conv_info, int depth_multiplier = 1, DepthwiseConvolutionMethod method = DepthwiseConvolutionMethod::Default, - ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr, const QuantizationInfo quant_info = QuantizationInfo()); + ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr, const QuantizationInfo quant_info = QuantizationInfo(), + const QuantizationInfo out_quant_info = QuantizationInfo()); /** Adds an element-wise layer node to the graph * * @param[in] g Graph to add the node to -- cgit v1.2.1