aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/graph/backends/FunctionHelpers.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2020-02-20 17:09:28 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-02-26 13:35:36 +0000
commit0b192e84510c006d87cee3c29f95511ad088b704 (patch)
tree80abef10e2afde5dcab6715b207ebca4d7dc0755 /arm_compute/graph/backends/FunctionHelpers.h
parent582163206bbfb03b3af0009d6ec2d9bab747780d (diff)
downloadComputeLibrary-0b192e84510c006d87cee3c29f95511ad088b704.tar.gz
COMPMID-3067: Address gcc9 failures
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I048d1d7dda7edf587d37ce83a93b557d8a95754a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2771 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/graph/backends/FunctionHelpers.h')
-rw-r--r--arm_compute/graph/backends/FunctionHelpers.h73
1 files changed, 40 insertions, 33 deletions
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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<arm_compute::IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<IFunction> 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<arm_compute::IFunction> 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<IFunction> 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<IFunction> 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