COMPMID-459 Collapse CL Im2col's higher dimensions

Change-Id: I0ccc39cbcf6926e6810faf3fe264c4af7adc3f7b
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/83070
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
diff --git a/arm_compute/core/CL/ICLKernel.h b/arm_compute/core/CL/ICLKernel.h
index 72c963d..c5e95aa 100644
--- a/arm_compute/core/CL/ICLKernel.h
+++ b/arm_compute/core/CL/ICLKernel.h
@@ -65,6 +65,13 @@
      * @param[in]     window Window the kernel will be executed on.
      */
     void add_3D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window);
+    /** Add the passed 4D tensor's parameters to the object's kernel's arguments starting from the index idx.
+     *
+     * @param[in,out] idx    Index at which to start adding the tensor's arguments. Will be incremented by the number of kernel arguments set.
+     * @param[in]     tensor Tensor to set as an argument of the object's kernel.
+     * @param[in]     window Window the kernel will be executed on.
+     */
+    void add_4D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window);
     /** Returns the number of arguments enqueued per 1D tensor object.
      *
      * @return The number of arguments enqueues per 1D tensor object.
@@ -80,6 +87,11 @@
      * @return The number of arguments enqueues per 3D tensor object.
      */
     unsigned int num_arguments_per_3D_tensor() const;
+    /** Returns the number of arguments enqueued per 4D tensor object.
+     *
+     * @return The number of arguments enqueues per 4D tensor object.
+     */
+    unsigned int num_arguments_per_4D_tensor() const;
     /** Enqueue the OpenCL kernel to process the given window  on the passed OpenCL command queue.
      *
      * @note The queue is *not* flushed by this method, and therefore the kernel will not have been executed by the time this method returns.
diff --git a/arm_compute/core/Validate.h b/arm_compute/core/Validate.h
index dd71f2c..34da339 100644
--- a/arm_compute/core/Validate.h
+++ b/arm_compute/core/Validate.h
@@ -147,6 +147,21 @@
                                 const Window &full, const Window &sub);
 #define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s) ::arm_compute::error_on_invalid_subwindow(__func__, __FILE__, __LINE__, f, s)
 
+/** Throw an error if the window can't be collapsed at the given dimension.
+ *
+ * The window cannot be collapsed if the given dimension not equal to the full window's dimension or not start from 0.
+ *
+ *  @param[in] function Function in which the error occurred.
+ *  @param[in] file     Name of the file where the error occurred.
+ *  @param[in] line     Line on which the error occurred.
+ *  @param[in] full     Full size window
+ *  @param[in] window   Window to be collapsed.
+ *  @param[in] dim      Dimension need to be checked.
+ */
+void error_on_window_not_collapsable_at_dimension(const char *function, const char *file, const int line,
+                                                  const Window &full, const Window &window, const int dim);
+#define ARM_COMPUTE_ERROR_ON_WINDOW_NOT_COLLAPSABLE_AT_DIMENSION(f, w, d) ::arm_compute::error_on_window_not_collapsable_at_dimension(__func__, __FILE__, __LINE__, f, w, d)
+
 /** Throw an error if the passed coordinates have too many dimensions.
  *
  * The coordinates have too many dimensions if any of the dimensions greater or equal to max_dim is different from 0.