aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2019-11-08 13:47:53 +0000
committerSiCongLi <sicong.li@arm.com>2019-12-11 18:52:46 +0000
commit6f58d1ec864b9a4960181ceeab177cd0db54e2e1 (patch)
tree14c8435126da52243f2c6eb4b39317fd37e6260c /arm_compute
parente6c3344f2a76b0724172200b1d5a443393045336 (diff)
downloadComputeLibrary-6f58d1ec864b9a4960181ceeab177cd0db54e2e1.tar.gz
COMPMID-2855: NEReduceMean throws error for invalid configs
Change-Id: I600507d0de19d7da6c1a13edcfff0a11ea6b5264 Signed-off-by: Pablo Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/2254 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/Helpers.h14
-rw-r--r--arm_compute/runtime/NEON/functions/NEReduceMean.h2
2 files changed, 15 insertions, 1 deletions
diff --git a/arm_compute/core/Helpers.h b/arm_compute/core/Helpers.h
index 87b1fdf64c..8d526e96c0 100644
--- a/arm_compute/core/Helpers.h
+++ b/arm_compute/core/Helpers.h
@@ -766,6 +766,20 @@ inline T wrap_around(T x, T m)
return x >= 0 ? x % m : (x % m + m) % m;
}
+/** Convert negative coordinates to positive in the range [0, num_dims_input]
+ *
+ * @param[out] coords Array of coordinates to be converted.
+ * @param[in] max_value Maximum value to be used when wrapping the negative values in coords
+ */
+inline Coordinates &convert_negative_axis(Coordinates &coords, int max_value)
+{
+ for(unsigned int i = 0; i < coords.num_dimensions(); ++i)
+ {
+ coords[i] = wrap_around(coords[i], max_value);
+ }
+ return coords;
+}
+
/** Given an integer value, this function returns the next power of two
*
* @param[in] x Input value
diff --git a/arm_compute/runtime/NEON/functions/NEReduceMean.h b/arm_compute/runtime/NEON/functions/NEReduceMean.h
index fdd8edfe87..245f7577ce 100644
--- a/arm_compute/runtime/NEON/functions/NEReduceMean.h
+++ b/arm_compute/runtime/NEON/functions/NEReduceMean.h
@@ -72,7 +72,7 @@ private:
std::vector<NEReductionOperation> _reduction_kernels;
std::vector<Tensor> _reduced_outs;
NEReshapeLayer _reshape;
- unsigned int _reduction_ops;
+ int _reduction_ops;
bool _keep_dims;
};
} // namespace arm_compute