aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2021-01-05 09:46:16 +0000
committerGiorgio Arena <giorgio.arena@arm.com>2021-01-05 13:55:06 +0000
commitb309fc249e4383b4d40ae03e377c3cbad3f9f5f7 (patch)
treec409dc7e0ce3080efc030d1082c60e451def97f1 /arm_compute
parent97b3f11a1655c05bedaf378f85f94cdccb1536ba (diff)
downloadComputeLibrary-b309fc249e4383b4d40ae03e377c3cbad3f9f5f7.tar.gz
Fix uniform_real_distribution_fp16 warning and single Dimension increment
- Change uniform_real_distribution_fp16's arguments to float to avoid maybe-uninitialized warnings in half data type's copy constructor and converter - Add increment method to Dimensions in order to avoid possible overflows when incrementing single dimensions - Remove internal_only flag documentation Resolves: COMPMID-4061 Change-Id: I7c50487193bd7b47b03d52fc595840c7df4e7104 Signed-off-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4760 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/Dimensions.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/arm_compute/core/Dimensions.h b/arm_compute/core/Dimensions.h
index d487b997a3..175d1e8098 100644
--- a/arm_compute/core/Dimensions.h
+++ b/arm_compute/core/Dimensions.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -97,6 +97,21 @@ public:
{
return _id[2];
}
+ /** Increments the given dimension by a step size, avoiding overflows
+ *
+ * @note Precondition: dim < _num_dimensions
+ *
+ * @param[in] dim Dimension to increment.
+ * @param[in] step Step to increment @p dim by.
+ */
+ void increment(size_t dim, T step = 1)
+ {
+ ARM_COMPUTE_ERROR_ON(dim < _num_dimensions);
+ if((std::numeric_limits<T>::max() - _id[dim]) <= step)
+ {
+ _id[dim] += step;
+ }
+ }
/** Generic accessor to get the size of any dimension
*
* @note Precondition: dimension < Dimensions::num_max_dimensions