COMPMID-462: Implement TensorReshape for NEON and CL.

Change-Id: I11b39c2ceca26ade73822e29a384ef866ae05729
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87707
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
diff --git a/arm_compute/core/Helpers.inl b/arm_compute/core/Helpers.inl
index e20bdb5..c2ca3b4 100644
--- a/arm_compute/core/Helpers.inl
+++ b/arm_compute/core/Helpers.inl
@@ -333,4 +333,41 @@
 
     return ValidRegion(std::move(anchor), std::move(new_dst_shape));
 }
+
+inline Coordinates index2coords(const TensorShape &shape, int index)
+{
+    int num_elements = shape.total_size();
+
+    ARM_COMPUTE_ERROR_ON_MSG(index < 0 || index >= num_elements, "Index has to be in [0, num_elements]!");
+    ARM_COMPUTE_ERROR_ON_MSG(num_elements == 0, "Cannot create coordinate from empty shape!");
+
+    Coordinates coord{ 0 };
+
+    for(int d = shape.num_dimensions() - 1; d >= 0; --d)
+    {
+        num_elements /= shape[d];
+        coord.set(d, index / num_elements);
+        index %= num_elements;
+    }
+
+    return coord;
+}
+
+inline int coords2index(const TensorShape &shape, const Coordinates &coord)
+{
+    int num_elements = shape.total_size();
+    ARM_COMPUTE_UNUSED(num_elements);
+    ARM_COMPUTE_ERROR_ON_MSG(num_elements == 0, "Cannot create linear index from empty shape!");
+
+    int index  = 0;
+    int stride = 1;
+
+    for(unsigned int d = 0; d < coord.num_dimensions(); ++d)
+    {
+        index += coord[d] * stride;
+        stride *= shape[d];
+    }
+
+    return index;
+}
 } // namespace arm_compute