From 484e7b3724c0e77751b5bed05180271fd5376e5d Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Wed, 9 Aug 2017 11:43:18 +0100 Subject: COMPMID-417: Cleanup NEON FullyConnectedLayer Change-Id: Ie02a0a1a28ca2771e29a5e6552242caf0f6db1cf Reviewed-on: http://mpd-gerrit.cambridge.arm.com/83555 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- arm_compute/core/TensorShape.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'arm_compute/core/TensorShape.h') diff --git a/arm_compute/core/TensorShape.h b/arm_compute/core/TensorShape.h index 6cf08de114..8d15c50220 100644 --- a/arm_compute/core/TensorShape.h +++ b/arm_compute/core/TensorShape.h @@ -137,8 +137,6 @@ public: return std::accumulate(_id.begin(), _id.end(), 1, std::multiplies()); } /** Collapses given dimension and above. - * - * @note Precondition: dimension < TensorShape::num_max_dimensions * * @param[in] dimension Size of the wanted dimension * @@ -146,9 +144,22 @@ public: */ size_t total_size_upper(size_t dimension) const { + ARM_COMPUTE_ERROR_ON(dimension >= TensorShape::num_max_dimensions); return std::accumulate(_id.begin() + dimension, _id.end(), 1, std::multiplies()); } + /** Compute size of dimensions lower than the given one. + * + * @param[in] dimension Upper boundary. + * + * @return The linear size of the collapsed dimensions. + */ + size_t total_size_lower(size_t dimension) const + { + ARM_COMPUTE_ERROR_ON(dimension > TensorShape::num_max_dimensions); + return std::accumulate(_id.begin(), _id.begin() + dimension, 1, std::multiplies()); + } + private: /** Remove trailing dimensions of size 1 from the reported number of dimensions. */ void apply_dimension_correction() -- cgit v1.2.1