From 0b192e84510c006d87cee3c29f95511ad088b704 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 20 Feb 2020 17:09:28 +0000 Subject: COMPMID-3067: Address gcc9 failures Signed-off-by: Georgios Pinitas Change-Id: I048d1d7dda7edf587d37ce83a93b557d8a95754a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2771 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- arm_compute/graph/backends/FunctionHelpers.h | 73 +++++++++++++++------------- 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'arm_compute/graph/backends/FunctionHelpers.h') diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h index 20c69bfffa..44b24b58bf 100644 --- a/arm_compute/graph/backends/FunctionHelpers.h +++ b/arm_compute/graph/backends/FunctionHelpers.h @@ -47,6 +47,13 @@ namespace backends { namespace detail { +// Address rule DR-9R5 (1579. Return by converting move constructor) +#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5)) +#define RETURN_UNIQUE_PTR(x) (x) +#else /* defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5)) */ +#define RETURN_UNIQUE_PTR(x) (std::move(x)) +#endif /* defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5)) */ + /** Returns backing tensor of a given tensor * * @tparam TargetInfo Target information @@ -121,7 +128,7 @@ std::unique_ptr create_activation_layer(ActivationLayerNode &node) << " InPlace : " << is_in_place_operation(input, output) << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend batch normalization layer function @@ -165,7 +172,7 @@ std::unique_ptr create_batch_normalization_layer(BatchNormalizationLa << " InPlace: " << is_in_place_operation(input, output) << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend batch normalization layer function @@ -222,7 +229,7 @@ std::unique_ptr create_fused_convolution_batch_normalization_layer(Fu << " Output shape: " << output->info()->tensor_shape() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend fused depthwise convolution batch normalization layer function @@ -278,7 +285,7 @@ std::unique_ptr create_fused_depthwise_convolution_batch_normalizatio << " Output shape: " << output->info()->tensor_shape() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend bounding box transform layer function @@ -316,7 +323,7 @@ std::unique_ptr create_bounding_box_transform_layer(BoundingBoxTransf << " BoundingBox Info img H: " << bbox_info.img_height() << " " << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend channel shuffle layer function @@ -351,7 +358,7 @@ std::unique_ptr create_channel_shuffle_layer(ChannelShuffleLayerNode << " Num groups: " << num_groups << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend layer concatenate function @@ -407,7 +414,7 @@ std::unique_ptr create_concatenate_layer(ConcatenateLaye << qss.str() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend convolution layer function @@ -498,7 +505,7 @@ std::unique_ptr create_convolution_layer(ConvolutionLayerNode &node, << qss.str() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend deconvolution layer function @@ -604,7 +611,7 @@ std::unique_ptr create_depthwise_convolution_layer(DepthwiseConvoluti << qss.str() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend dequantize layer function @@ -643,7 +650,7 @@ std::unique_ptr create_dequantization_layer(DequantizationLayerNode & << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend detection output layer function * @@ -688,7 +695,7 @@ std::unique_ptr create_detection_output_layer(DetectionOutputLayerNod << " DetectionOutputLayer info: " << detect_info << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend detection post process layer function @@ -743,7 +750,7 @@ std::unique_ptr create_detection_post_process_layer(DetectionPostProc << " DetectionPostProcessLayer info: " << detect_info << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend element-wise operation layer function @@ -805,7 +812,7 @@ std::unique_ptr create_eltwise_layer(EltwiseLayerNode &node) << " Shape: " << input1->info()->tensor_shape() << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend flatten layer function @@ -843,7 +850,7 @@ std::unique_ptr create_flatten_layer(FlattenLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend fully connected layer function @@ -899,7 +906,7 @@ std::unique_ptr create_fully_connected_layer(FullyConnectedLayerNode << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend generate proposals layer function @@ -948,7 +955,7 @@ std::unique_ptr create_generate_proposals_layer(GenerateProposalsLaye << " Scores Out shape: " << scores_out->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend normalization layer function @@ -990,7 +997,7 @@ std::unique_ptr create_normalization_layer(NormalizationLayerNode &no << " Normalization info: " << norm_info.type() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend normalize planar YUV layer function @@ -1030,7 +1037,7 @@ std::unique_ptr create_normalize_planar_yuv_layer(NormalizePlanarYUVL << " Shape: " << input->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend pad layer function @@ -1069,7 +1076,7 @@ std::unique_ptr create_pad_layer(PadLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend permute layer function @@ -1108,7 +1115,7 @@ std::unique_ptr create_permute_layer(PermuteLayerNode &node) << " Permutation vector: " << perm << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend pooling layer function @@ -1147,7 +1154,7 @@ std::unique_ptr create_pooling_layer(PoolingLayerNode &node) << " Pooling info: " << pool_info.pool_type << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend PRelu layer function @@ -1185,7 +1192,7 @@ std::unique_ptr create_prelu_layer(PReluLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend print layer function @@ -1256,7 +1263,7 @@ std::unique_ptr create_priorbox_layer(PriorBoxLayerNode &node) << " PriorBoxLayer info: " << prior_info << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend quantization layer function @@ -1293,7 +1300,7 @@ std::unique_ptr create_quantization_layer(QuantizationLayerNode &node << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend reorg layer function @@ -1330,7 +1337,7 @@ std::unique_ptr create_reorg_layer(ReorgLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend reshape layer function @@ -1367,7 +1374,7 @@ std::unique_ptr create_reshape_layer(ReshapeLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend resize layer function @@ -1406,7 +1413,7 @@ std::unique_ptr create_resize_layer(ResizeLayerNode &node) << " Interpolation: " << policy << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend ROI align layer function @@ -1451,7 +1458,7 @@ std::unique_ptr create_roi_align_layer(ROIAlignLayerNode &node) << " ROIPooling height: " << pool_info.pooled_height() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend slice layer function @@ -1488,7 +1495,7 @@ std::unique_ptr create_slice_layer(SliceLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend softmax layer function @@ -1527,7 +1534,7 @@ std::unique_ptr create_softmax_layer(SoftmaxLayerNode &node, GraphCon << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend layer stack function @@ -1570,7 +1577,7 @@ std::unique_ptr create_stack_layer(StackLayerNode &node) << " Axis: " << axis << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend Upsample layer function * @@ -1614,7 +1621,7 @@ std::unique_ptr create_upsample_layer(UpsampleLayerNode &node, GraphC << " Upsampling policy: " << upsampling_policy << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend YOLO layer function * @@ -1657,7 +1664,7 @@ std::unique_ptr create_yolo_layer(YOLOLayerNode &node, GraphContext & << " Num classes: " << num_classes << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } } // namespace detail } // namespace backends -- cgit v1.2.1