CMSIS-NN: Update max pool to new interface

1. TFLu compatible max pool is updated to new interface to use
   pass by reference arguments.

2. arm_max_pool_s8_opt() is merged into arm_max_pool_s8().

3. Unit tests are added for max pool.

Change-Id: Iec0116b37c1167d785fc21ec35bdf50c05d6647e
diff --git a/CMSIS/DoxyGen/NN/src/history.txt b/CMSIS/DoxyGen/NN/src/history.txt
index f3058bc..600c703 100644
--- a/CMSIS/DoxyGen/NN/src/history.txt
+++ b/CMSIS/DoxyGen/NN/src/history.txt
@@ -14,6 +14,11 @@
         <li>arm_depthwise_conv_wrapper_s8</li>
         <li>arm_convolve_wrapper_s8</li>
       </ul>
+      Deleted functions
+      <ul>
+        <li>arm_max_pool_s8_opt</li>
+      </ul>
+
     </td>
   </tr>
   <tr>
diff --git a/CMSIS/NN/Include/arm_nnfunctions.h b/CMSIS/NN/Include/arm_nnfunctions.h
index 035bde0..70c0861 100644
--- a/CMSIS/NN/Include/arm_nnfunctions.h
+++ b/CMSIS/NN/Include/arm_nnfunctions.h
@@ -21,8 +21,8 @@
  * Title:        arm_nnfunctions.h
  * Description:  Public header file for CMSIS NN Library
  *
- * $Date:        May 29, 2020
- * $Revision:    V.5.0.1
+ * $Date:        June 11, 2020
+ * $Revision:    V.6.0.1
  *
  * Target Processor:  Cortex-M CPUs
  * -------------------------------------------------------------------- */
@@ -1684,93 +1684,36 @@
                                            const int ch_src);
 
    /**
-   * @brief s8 DSP optimized max pooling function
-   * @param[in]       input_y     input tensor dimension along y
-   * @param[in]       input_x     input tensor dimension along x
-   * @param[in]       output_y    output tensor dimension along y
-   * @param[in]       output_x    output tensor dimension along x
-   * @param[in]       stride_y    stride along y
-   * @param[in]       stride_x    stride along x
-   * @param[in]       kernel_y    filter kernel size along y
-   * @param[in]       kernel_x    filter kernel size along x
-   * @param[in]       pad_y       padding size along y
-   * @param[in]       pad_x       padding size along x
-   * @param[in]       act_min     Activation min. Lower limit to clamp output to. Range: int8
-   * @param[in]       act_max     Activation max. Upper limit to clamp output to. Range: int8
-   * @param[in]       depth       number of input channels
-   * @param[in]       input       pointer to input tensor
-   * @param[in]       tmp_buffer  Not used.
-   * @param[in,out]   output      pointer to output tensor
-   * @return                      The function returns one of the following
-   *                              <code>ARM_MATH_SIZE_MISMATCH</code> - Unsupported dimension of tensors
-   *                              <code>ARM_MATH_SUCCESS</code> - Successful operation
-   *                              <code>ARM_MATH_ARGUMENT_ERROR</code> - Implementation not available
-   * @note The input data is corrupted by this function.
-   * @details This optimized implementation is recommended when depth is >=  4 and dimensions are large.
+   * @brief s8 max pooling function.
    *
-   */
-
-    arm_status arm_max_pool_s8_opt(const uint16_t input_y,
-                                   const uint16_t input_x,
-                                   const uint16_t output_y,
-                                   const uint16_t output_x,
-                                   const uint16_t stride_y,
-                                   const uint16_t stride_x,
-                                   const uint16_t kernel_y,
-                                   const uint16_t kernel_x,
-                                   const uint16_t pad_y,
-                                   const uint16_t pad_x,
-                                   const int8_t act_min,
-                                   const int8_t act_max,
-                                   const uint16_t depth,
-                                   int8_t *input,
-                                   int16_t *tmp_buffer,
-                                   int8_t *output);
-
-  /**
-   * @brief s8 pure C max pooling function
-   * @param[in]       input_y     input tensor dimension along y
-   * @param[in]       input_x     input tensor dimension along x
-   * @param[in]       output_y    output tensor dimension along y
-   * @param[in]       output_x    output tensor dimension along x
-   * @param[in]       stride_y    stride along y
-   * @param[in]       stride_x    stride along x
-   * @param[in]       kernel_y    filter kernel size along y
-   * @param[in]       kernel_x    filter kernel size along x
-   * @param[in]       pad_y       padding size along y
-   * @param[in]       pad_x       padding size along x
-   * @param[in]       act_min     Activation min. Lower limit to clamp output to. Range: int8
-   * @param[in]       act_max     Activation max. Upper limit to clamp output to. Range: int8
-   * @param[in]       channel_in  number of input channels
-   * @param[in]       input       pointer to input tensor
-   * @param[in]       tmp_buffer  Not used.
-   * @param[in,out]   output      pointer to output tensor
-   * @return                      The function returns one of the following
-   *                              <code>ARM_MATH_SIZE_MISMATCH</code> - Unsupported dimension of tensors
-   *                              <code>ARM_MATH_SUCCESS</code> - Successful operation
-   *                              <code>ARM_MATH_ARGUMENT_ERROR</code> - Implementation not available
+   * @param[in, out] ctx            Function context (e.g. temporary buffer). Check the function
+   *                                definition file to see if an additional buffer is required.
+   *                                Optional function {API}_get_buffer_size() provides the buffer
+   *                                size if an additional buffer is required.
+   * @param[in]      pool_params    Pooling parameters
+   * @param[in]      input_dims     Input (activation) tensor dimensions. Format: [H, W, C_IN]
+   *                                Argument 'N' is not used.
+   * @param[in]      input_data     Input (activation) data pointer. Data type: int8
+   * @param[in]      filter_dims    Filter tensor dimensions. Format: [H, W]
+   *                                Argument N and C are not used.
+   * @param[in]      output_dims    Output tensor dimensions. Format: [H, W, C_OUT]
+   *                                Argument N is not used.
+   *                                C_OUT equals C_IN.
+   * @param[in, out] output_data    Output data pointer. Data type: int8
+   * @return                        The function returns
+   *                                    <code>ARM_MATH_SUCCESS</code> - Successful operation
    *
    * @details
-   *    - This basic implementation is recommended when number of channels is less than 4 and/or
-   *      dimensions are small.
+   *    - Supported Framework: TensorFlow Lite
    *
    */
-    arm_status arm_max_pool_s8(const uint16_t input_y,
-                               const uint16_t input_x,
-                               const uint16_t output_y,
-                               const uint16_t output_x,
-                               const uint16_t stride_y,
-                               const uint16_t stride_x,
-                               const uint16_t kernel_y,
-                               const uint16_t kernel_x,
-                               const uint16_t pad_y,
-                               const uint16_t pad_x,
-                               const int8_t act_min,
-                               const int8_t act_max,
-                               const uint16_t channel_in,
-                               int8_t *input,
-                               int16_t *tmp_buffer,
-                               int8_t *output);
+    arm_status arm_max_pool_s8(const cmsis_nn_context *ctx,
+                               const cmsis_nn_pool_params *pool_params,
+                               const cmsis_nn_dims *input_dims,
+                               const q7_t *input_data,
+                               const cmsis_nn_dims *filter_dims,
+                               const cmsis_nn_dims *output_dims,
+                               q7_t *output_data);
 /**
  * @defgroup Softmax Softmax Functions
  *
diff --git a/CMSIS/NN/README.md b/CMSIS/NN/README.md
index a66bc60..980d93e 100644
--- a/CMSIS/NN/README.md
+++ b/CMSIS/NN/README.md
@@ -30,9 +30,8 @@
 |[Fully Connected](https://arm-software.github.io/CMSIS_5/NN/html/group__FC.html)||||| |  | |
 || arm_fully_connected_s8() |FULLY CONNECTED & <br/> MAT MUL  | None | 0 | Yes | Yes | |
 |[Pooling](https://arm-software.github.io/CMSIS_5/NN/html/group__Pooling.html)||||| |  ||
-|| arm_avgpool_s8() | AVERAGE POOL | None | input_ch * 2 | Yes| Yes| Best case case is when channels are multiple of 4 or <br/> at the least >= 4 |
-|| arm_maxpool_s8() | MAX POOL | None | None | No| No|  |
-|| arm_maxpool_s8_opt() | MAX POOL | None | input_ch * output_x * 2 | Yes|Yes| Best case case is when channels are multiple of 4 or <br/> at the least >= 4 |
+|| arm_avgpool_s8() | AVERAGE POOL | None | input_ch * 2<br/>(DSP only) | Yes| Yes| Best case case is when channels are multiple of 4 or <br/> at the least >= 4 |
+|| arm_maxpool_s8() | MAX POOL | None | None | Yes| Yes|  |
 |[Softmax](https://arm-software.github.io/CMSIS_5/NN/html/group__Softmax.html)||||| |  ||
 ||arm_softmax_q7()| SOFTMAX | None | None | Yes | No | Not bit exact to TFLu but can be up to 70x faster |
 ||arm_softmax_s8()| SOFTMAX | None | None | No | Yes | Bit exact to TFLu |
diff --git a/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8.c b/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8.c
old mode 100644
new mode 100755
index 8b630c5..33a4436
--- a/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8.c
+++ b/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved.
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -19,17 +19,134 @@
 /* ----------------------------------------------------------------------
  * Project:      CMSIS NN Library
  * Title:        arm_max_pool_s8.c
- * Description:  Pure C max pool implementation
+ * Description:  Pooling function implementations
  *
- * $Date:        August 2019
- * $Revision:    V.1.0.0
+ * $Date:        June 11, 2020
+ * $Revision:    V.2.0.0
  *
- * Target Processor:  Cortex-M cores
+ * Target Processor:  Cortex-M CPUs
  *
  * -------------------------------------------------------------------- */
 
-#include "arm_nnfunctions.h"
 #include "arm_math.h"
+#include "arm_nnfunctions.h"
+
+static void compare_and_replace_if_larger_q7(q7_t *base,
+                                             const q7_t *target,
+                                             int32_t length)
+{
+#if defined(ARM_MATH_MVEI)
+    int32_t loop_count = (length + 15) / 16;
+    for (int i = 0; i < loop_count; i++)
+    {
+        mve_pred16_t p = vctp16q((uint32_t)length);
+        const int8x16_t op_1 = vldrbq_z_s8(base, p);
+        const int8x16_t op_2 = vldrbq_z_s8(target, p);
+        const int8x16_t max = vmaxq_m_s8(vuninitializedq_s8(), op_1, op_2, p);
+        vstrbq_p_s8(base, max, p);
+        base += 16;
+        target += 16;
+        length -= 16;
+    }
+#else
+    q7_t *dst = base;
+    const q7_t *src = target;
+    union arm_nnword ref_max;
+    union arm_nnword comp_max;
+    int32_t cnt = length >> 2;
+
+    while (cnt > 0l)
+    {
+        ref_max.word = arm_nn_read_q7x4(dst);
+        comp_max.word = arm_nn_read_q7x4_ia(&src);
+
+        if (comp_max.bytes[0] > ref_max.bytes[0])
+        {
+            ref_max.bytes[0] = comp_max.bytes[0];
+        }
+        if (comp_max.bytes[1] > ref_max.bytes[1])
+        {
+            ref_max.bytes[1] = comp_max.bytes[1];
+        }
+        if (comp_max.bytes[2] > ref_max.bytes[2])
+        {
+            ref_max.bytes[2] = comp_max.bytes[2];
+        }
+        if (comp_max.bytes[3] > ref_max.bytes[3])
+        {
+            ref_max.bytes[3] = comp_max.bytes[3];
+        }
+
+        write_q7x4_ia(&dst, ref_max.word);
+
+        cnt--;
+    }
+
+    cnt = length & 0x3;
+    while (cnt > 0l)
+    {
+        if (*src > *dst)
+        {
+            *dst = *src;
+        }
+        dst++;
+        src++;
+        cnt--;
+    }
+#endif
+}
+
+static void
+clamp_output(q7_t *source, int32_t length, const int32_t act_min, const int32_t act_max)
+{
+#if defined(ARM_MATH_MVEI)
+    int32_t
+        loop_count = (length + 15) / 16;
+    for (int i = 0; i < loop_count; i++)
+    {
+        mve_pred16_t p = vctp16q((uint32_t)length);
+        length -= 16;
+        const int8x16_t src = vldrbq_z_s8(source, p);
+        const int8x16_t predicated_min = vdupq_m_n_s8(vuninitializedq_s8(), (int8_t)act_min, p);
+        const int8x16_t predicated_max = vdupq_m_n_s8(vuninitializedq_s8(), (int8_t)act_max, p);
+        int8x16_t
+            res = vmaxq_m_s8(vuninitializedq_s8(), src, predicated_min, p);
+        res = vminq_m_s8(vuninitializedq_s8(), src, predicated_max, p);
+        vstrbq_p_s8(source, res, p);
+        source += 16;
+    }
+#else
+    union arm_nnword in;
+    int32_t cnt = length >> 2;
+
+    while (cnt > 0l)
+    {
+        in.word = arm_nn_read_q7x4(source);
+
+        in.bytes[0] = MAX(in.bytes[0], act_min);
+        in.bytes[0] = MIN(in.bytes[0], act_max);
+        in.bytes[1] = MAX(in.bytes[1], act_min);
+        in.bytes[1] = MIN(in.bytes[1], act_max);
+        in.bytes[2] = MAX(in.bytes[2], act_min);
+        in.bytes[2] = MIN(in.bytes[2], act_max);
+        in.bytes[3] = MAX(in.bytes[3], act_min);
+        in.bytes[3] = MIN(in.bytes[3], act_max);
+
+        write_q7x4_ia(&source, in.word);
+        cnt--;
+    }
+
+    cnt = length & 0x3;
+    while (cnt > 0l)
+    {
+        int32_t comp = *source;
+        comp = MAX(comp, act_min);
+        comp = MIN(comp, act_max);
+        *source++ = (int8_t)comp;
+        cnt--;
+    }
+#endif
+}
 
 /**
  *  @ingroup groupNN
@@ -40,64 +157,76 @@
  * @{
  */
 
-arm_status arm_max_pool_s8(const uint16_t input_y,
-                           const uint16_t input_x,
-                           const uint16_t output_y,
-                           const uint16_t output_x,
-                           const uint16_t stride_y,
-                           const uint16_t stride_x,
-                           const uint16_t kernel_y,
-                           const uint16_t kernel_x,
-                           const uint16_t pad_y,
-                           const uint16_t pad_x,
-                           const int8_t act_min,
-                           const int8_t act_max,
-                           const uint16_t channel_in,
-                           int8_t *input,
-                           int16_t *tmp_buffer,
-                           int8_t *output)
+/*
+   * Optimized s8 max pooling function
+   *
+   * Refer to header file for details.
+   *
+   */
+
+arm_status
+arm_max_pool_s8(const cmsis_nn_context *ctx,
+                const cmsis_nn_pool_params *pool_params,
+                const cmsis_nn_dims *input_dims,
+                const q7_t *src,
+                const cmsis_nn_dims *filter_dims,
+                const cmsis_nn_dims *output_dims,
+                q7_t *dst)
 {
-    int32_t i_ch_in, i_out_x, i_out_y;
-    int32_t i_ker_x, i_ker_y;
-    (void)tmp_buffer;
+    const int32_t input_y = input_dims->h;
+    const int32_t input_x = input_dims->w;
+    const int32_t output_y = output_dims->h;
+    const int32_t output_x = output_dims->w;
+    const int32_t stride_y = pool_params->stride.h;
+    const int32_t stride_x = pool_params->stride.w;
+    const int32_t kernel_y = filter_dims->h;
+    const int32_t kernel_x = filter_dims->w;
+    const int32_t pad_y = pool_params->padding.h;
+    const int32_t pad_x = pool_params->padding.w;
+    const int32_t act_min = pool_params->activation.min;
+    const int32_t act_max = pool_params->activation.max;
+    const int32_t channel_in = input_dims->c;
+    (void)ctx;
+    q7_t *dst_base = dst;
 
-    for (i_out_y = 0; i_out_y < output_y; i_out_y++)
+    for (int i_y = 0, base_idx_y = -pad_y; i_y < output_y; base_idx_y += stride_y, i_y++)
     {
-        for (i_out_x = 0; i_out_x < output_x; i_out_x++)
+        for (int i_x = 0, base_idx_x = -pad_x; i_x < output_x; base_idx_x += stride_x, i_x++)
         {
-            for (i_ch_in = 0; i_ch_in < channel_in; i_ch_in++)
+            /* Condition for kernel start dimension: (base_idx_<x,y> + kernel_<x,y>_start) >= 0 */
+            const int32_t ker_y_start = MAX(0, -base_idx_y);
+            const int32_t ker_x_start = MAX(0, -base_idx_x);
+
+            /* Condition for kernel end dimension: (base_idx_<x,y> + kernel_<x,y>_end) < dim_src_<width,height> */
+            const int32_t kernel_y_end = MIN(kernel_y, input_y - base_idx_y);
+            const int32_t kernel_x_end = MIN(kernel_x, input_x - base_idx_x);
+
+            int count = 0;
+
+            for (int k_y = ker_y_start; k_y < kernel_y_end; k_y++)
             {
-                /* Native data type for inner loop variables  */
-                int32_t max_val = (int8_t)Q7_MIN;
-                /* Condition for kernel start dimension: (base_idx_<x,y> + ker_<x,y>_start) >= 0 */
-                const int32_t base_idx_y = (i_out_y * stride_y) - pad_y;
-                const int32_t base_idx_x = (i_out_x * stride_x) - pad_x;
-                const int32_t ker_y_start = MAX(0, -base_idx_y);
-                const int32_t ker_x_start = MAX(0, -base_idx_x);
-
-                /* Condition for kernel end dimension: (base_idx_<x,y> + ker_<x,y>_end) < input_<x,y> */
-                const int32_t ker_y_end = MIN(kernel_y, input_y - base_idx_y);
-                const int32_t ker_x_end = MIN(kernel_x, input_x - base_idx_x);
-
-                for (i_ker_y = ker_y_start; i_ker_y < ker_y_end; i_ker_y++)
+                for (int k_x = ker_x_start; k_x < kernel_x_end; k_x++)
                 {
-                    for (i_ker_x = ker_x_start; i_ker_x < ker_x_end; i_ker_x++)
-                    {
-                        const int32_t col_idx = base_idx_x + i_ker_x;
-                        const int32_t row_idx = base_idx_y + i_ker_y;
+                    const q7_t *start = src + channel_in * (k_x + base_idx_x + (k_y + base_idx_y) * input_x);
 
-                        max_val = MAX(input[(row_idx * input_x + col_idx) * channel_in + i_ch_in], max_val);
+                    if (count == 0)
+                    {
+                        memcpy(dst, start, channel_in);
+                        count++;
+                    }
+                    else
+                    {
+                        compare_and_replace_if_larger_q7(dst, start, channel_in);
                     }
                 }
-
-                /* Activation function */
-                max_val = MAX(max_val, act_min);
-                max_val = MIN(max_val, act_max);
-
-                output[i_ch_in + channel_in * (i_out_x + i_out_y * output_x)] = (int8_t)max_val;
             }
+            /* 'count' is expected to be non-zero here. */
+            dst += channel_in;
         }
     }
+
+    clamp_output(dst_base, output_x * output_y * channel_in, act_min, act_max);
+
     return ARM_MATH_SUCCESS;
 }
 
diff --git a/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8_opt.c b/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8_opt.c
deleted file mode 100755
index 243e1e5..0000000
--- a/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8_opt.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
- *
- * SPDX-License-Identifier: Apache-2.0dim_dst_width
- *
- * Licensed under the Apache License, Version 2.0 (the License); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* ----------------------------------------------------------------------
- * Project:      CMSIS NN Library
- * Title:        arm_max_pool_s8_opt.c
- * Description:  Pooling function implementations
- *
- * $Date:        February 27, 2020
- * $Revision:    V.1.0.1
- *
- * Target Processor:  Cortex-M
- *
- * -------------------------------------------------------------------- */
-
-#include "arm_math.h"
-#include "arm_nnfunctions.h"
-
-#if defined(ARM_MATH_DSP)
-
-static void compare_and_replace_if_larger_q7(q7_t *base,
-                                             const q7_t *target,
-                                             const uint16_t length)
-{
-#if defined(ARM_MATH_MVEI)
-
-    int loop_count = length / 16;
-    while (loop_count)
-    {
-        const int8x16_t op_1 = vldrbq_s8(base);
-        const int8x16_t op_2 = vldrbq_s8(target);
-        const int8x16_t max = vmaxq_s8(op_1, op_2);
-        vstrbq_s8(base, max);
-        base += 16;
-        target += 16;
-        loop_count--;
-    }
-
-    if (((length & 0xF) / 8) > 0)
-    {
-        const int16x8_t op_1 = vldrbq_s16(base);
-        const int16x8_t op_2 = vldrbq_s16(target);
-        const int16x8_t max = vmaxq_s16(op_1, op_2);
-        vstrbq_s16(base, max);
-
-        base += 8;
-        target += 8;
-    }
-
-    for (int i = 0; i < (length & 7); i++)
-    {
-        if (target[i] > base[i])
-        {
-            base[i] = target[i];
-        }
-    }
-
-#else
-    q7_t *dst = base;
-    const q7_t *src = target;
-    union arm_nnword ref_max;
-    union arm_nnword comp_max;
-    int32_t cnt = length >> 2;
-
-    while (cnt > 0l)
-    {
-        ref_max.word = arm_nn_read_q7x4(dst);
-        comp_max.word = arm_nn_read_q7x4_ia(&src);
-
-        if (comp_max.bytes[0] > ref_max.bytes[0])
-        {
-            ref_max.bytes[0] = comp_max.bytes[0];
-        }
-        if (comp_max.bytes[1] > ref_max.bytes[1])
-        {
-            ref_max.bytes[1] = comp_max.bytes[1];
-        }
-        if (comp_max.bytes[2] > ref_max.bytes[2])
-        {
-            ref_max.bytes[2] = comp_max.bytes[2];
-        }
-        if (comp_max.bytes[3] > ref_max.bytes[3])
-        {
-            ref_max.bytes[3] = comp_max.bytes[3];
-        }
-
-        write_q7x4_ia(&dst, ref_max.word);
-
-        cnt--;
-    }
-
-    cnt = length & 0x3;
-    while (cnt > 0l)
-    {
-        if (*src > *dst)
-        {
-            *dst = *src;
-        }
-        dst++;
-        src++;
-        cnt--;
-    }
-#endif
-}
-
-static void clamp_output(q7_t *source, const uint16_t length, const int32_t act_min, const int32_t act_max)
-{
-#if defined(ARM_MATH_MVEI)
-
-    int cnt = length / 16;
-    while (cnt > 0)
-    {
-        const int8x16_t src = vldrbq_s8(source);
-        int8x16_t res = vmaxq_s8(src, vdupq_n_s8((int8_t)act_min));
-        res = vminq_s8(src, vdupq_n_s8((int8_t)act_max));
-        vstrbq_s8(source, res);
-        source += 16;
-        cnt--;
-    }
-
-    if (((length & 0xF) / 8) > 0)
-    {
-        const int16x8_t src = vldrbq_s16(source);
-        int16x8_t res = vmaxq_s16(src, vdupq_n_s16((int16_t)act_min));
-        res = vminq_s16(src, vdupq_n_s16((int16_t)act_max));
-        vstrbq_s16(source, res);
-        source += 8;
-    }
-
-    cnt = length & 7;
-    while (cnt > 0)
-    {
-        int32_t comp = *source;
-        comp = MAX(comp, act_min);
-        comp = MIN(comp, act_max);
-        *source++ = (int8_t)comp;
-        cnt--;
-    }
-
-#else
-    union arm_nnword in;
-    int32_t cnt = length >> 2;
-
-    while (cnt > 0l)
-    {
-        in.word = arm_nn_read_q7x4(source);
-
-        in.bytes[0] = MAX(in.bytes[0], act_min);
-        in.bytes[0] = MIN(in.bytes[0], act_max);
-        in.bytes[1] = MAX(in.bytes[1], act_min);
-        in.bytes[1] = MIN(in.bytes[1], act_max);
-        in.bytes[2] = MAX(in.bytes[2], act_min);
-        in.bytes[2] = MIN(in.bytes[2], act_max);
-        in.bytes[3] = MAX(in.bytes[3], act_min);
-        in.bytes[3] = MIN(in.bytes[3], act_max);
-
-        write_q7x4_ia(&source, in.word);
-        cnt--;
-    }
-
-    cnt = length & 0x3;
-    while (cnt > 0l)
-    {
-        int32_t comp = *source;
-        comp = MAX(comp, act_min);
-        comp = MIN(comp, act_max);
-        *source++ = (int8_t)comp;
-        cnt--;
-    }
-#endif
-}
-#endif
-
-/**
- *  @ingroup groupNN
- */
-
-/**
- * @addtogroup Pooling
- * @{
- */
-
-/*
-   * Optimized s8 max pooling function
-   *
-   * Refer to header file for details.
-   *
-   */
-
-arm_status arm_max_pool_s8_opt(const uint16_t input_y,
-                               const uint16_t input_x,
-                               const uint16_t output_y,
-                               const uint16_t output_x,
-                               const uint16_t stride_y,
-                               const uint16_t stride_x,
-                               const uint16_t kernel_y,
-                               const uint16_t kernel_x,
-                               const uint16_t pad_y,
-                               const uint16_t pad_x,
-                               const int8_t act_min,
-                               const int8_t act_max,
-                               const uint16_t depth,
-                               int8_t *src,
-                               int16_t *tmp_buffer,
-                               int8_t *dst)
-{
-
-#if defined(ARM_MATH_DSP)
-
-    /* Run the following code for Cortex-M4 and Cortex-M7 */
-    (void)tmp_buffer;
-    int32_t i_x, i_y;
-
-    /* first does the pooling along x axis */
-    for (i_y = 0; i_y < input_y; i_y++)
-    {
-
-        for (i_x = 0; i_x < output_x; i_x++)
-        {
-            /* for each output sample */
-            q7_t *target = src + (i_y * input_x + i_x) * depth;
-            q7_t *win_start;
-            q7_t *win_stop;
-            const int32_t x_origin = i_x * stride_x - pad_x;
-            if (x_origin < 0)
-            {
-                win_start = target;
-            }
-            else
-            {
-                win_start = src + (i_y * input_x + x_origin) * depth;
-            }
-
-            if (x_origin + kernel_x >= input_x)
-            {
-                win_stop = src + (i_y * input_x + input_x) * depth;
-            }
-            else
-            {
-                win_stop = src + (i_y * input_x + x_origin + kernel_x) * depth;
-            }
-
-            /* first step is to copy over initial data(along channel) along the channel in  x direction */
-            memmove(target, win_start, depth);
-
-            /* Move over to next element along x axis and compare with the base(target)  */
-            win_start += depth;
-            for (; win_start < win_stop; win_start += depth)
-            {
-                compare_and_replace_if_larger_q7(target, win_start, depth);
-            }
-        }
-    }
-
-    /* then does the pooling along y axis */
-    for (i_y = 0; i_y < output_y; i_y++)
-    {
-        /* for each output row */
-        q7_t *target = dst + i_y * output_x * depth;
-        q7_t *row_start;
-        q7_t *row_end;
-        const int32_t y_origin = i_y * stride_y - pad_y;
-        /* setting the starting row */
-        if (y_origin < 0)
-        {
-            row_start = src;
-        }
-        else
-        {
-            row_start = src + y_origin * input_x * depth;
-        }
-        /* setting the stopping row */
-        if (y_origin + kernel_y >= input_y)
-        {
-            row_end = src + input_y * input_x * depth;
-        }
-        else
-        {
-            row_end = src + (y_origin + kernel_y) * input_x * depth;
-        }
-
-        /* copy over the complete first row. */
-        memmove(target, row_start, output_x * depth);
-
-        /* move over to next row and compare with the base row (target)*/
-        row_start += depth * input_x;
-
-        for (; row_start < row_end; row_start += input_x * depth)
-        {
-            compare_and_replace_if_larger_q7(target, row_start, output_x * depth);
-        }
-    }
-
-    clamp_output(dst, output_x * output_y * depth, act_min, act_max);
-
-#else
-    /* Pure C implementation */
-    arm_max_pool_s8(input_y,
-                    input_x,
-                    output_y,
-                    output_x,
-                    stride_y,
-                    stride_x,
-                    kernel_y,
-                    kernel_x,
-                    pad_y,
-                    pad_x,
-                    act_min,
-                    act_max,
-                    depth,
-                    src,
-                    tmp_buffer,
-                    dst);
-#endif
-  return ARM_MATH_SUCCESS;
-}
-
-/**
- * @} end of Pooling group
- */
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_1/input.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_1/input.txt
new file mode 100644
index 0000000..1e55a1b
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_1/input.txt
@@ -0,0 +1,46 @@
+# 1,5,9,3
+5.000000000000000000e+00,-1.000000000000000000e+00,6.000000000000000000e+00
+-1.000000000000000000e+00,-4.000000000000000000e+00,-4.000000000000000000e+00
+5.000000000000000000e+00,-7.000000000000000000e+00,-4.000000000000000000e+00
+-3.000000000000000000e+00,-3.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00
+-6.000000000000000000e+00,0.000000000000000000e+00,-7.000000000000000000e+00
+5.000000000000000000e+00,-7.000000000000000000e+00,0.000000000000000000e+00
+-6.000000000000000000e+00,2.000000000000000000e+00,2.000000000000000000e+00
+1.000000000000000000e+00,-4.000000000000000000e+00,2.000000000000000000e+00
+-5.000000000000000000e+00,-1.000000000000000000e+00,4.000000000000000000e+00
+-4.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-6.000000000000000000e+00,0.000000000000000000e+00,-3.000000000000000000e+00
+-1.000000000000000000e+00,1.000000000000000000e+00,-3.000000000000000000e+00
+2.000000000000000000e+00,-3.000000000000000000e+00,-3.000000000000000000e+00
+1.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00
+2.000000000000000000e+00,-1.000000000000000000e+00,-4.000000000000000000e+00
+-4.000000000000000000e+00,3.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,2.000000000000000000e+00,-4.000000000000000000e+00
+6.000000000000000000e+00,3.000000000000000000e+00,-5.000000000000000000e+00
+-7.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+4.000000000000000000e+00,-7.000000000000000000e+00,-7.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00,4.000000000000000000e+00
+-3.000000000000000000e+00,2.000000000000000000e+00,0.000000000000000000e+00
+6.000000000000000000e+00,-7.000000000000000000e+00,5.000000000000000000e+00
+3.000000000000000000e+00,-6.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,6.000000000000000000e+00
+-4.000000000000000000e+00,-4.000000000000000000e+00,-4.000000000000000000e+00
+-6.000000000000000000e+00,-7.000000000000000000e+00,3.000000000000000000e+00
+-5.000000000000000000e+00,2.000000000000000000e+00,5.000000000000000000e+00
+-6.000000000000000000e+00,-2.000000000000000000e+00,-5.000000000000000000e+00
+0.000000000000000000e+00,6.000000000000000000e+00,-5.000000000000000000e+00
+-4.000000000000000000e+00,-5.000000000000000000e+00,5.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,-6.000000000000000000e+00,0.000000000000000000e+00
+4.000000000000000000e+00,-6.000000000000000000e+00,3.000000000000000000e+00
+-6.000000000000000000e+00,4.000000000000000000e+00,1.000000000000000000e+00
+-5.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00
+4.000000000000000000e+00,-4.000000000000000000e+00,-2.000000000000000000e+00
+5.000000000000000000e+00,0.000000000000000000e+00,-7.000000000000000000e+00
+5.000000000000000000e+00,1.000000000000000000e+00,-6.000000000000000000e+00
+-4.000000000000000000e+00,0.000000000000000000e+00,5.000000000000000000e+00
+-7.000000000000000000e+00,-7.000000000000000000e+00,-2.000000000000000000e+00
+-7.000000000000000000e+00,5.000000000000000000e+00,0.000000000000000000e+00
+0.000000000000000000e+00,-6.000000000000000000e+00,0.000000000000000000e+00
+-6.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_1/params.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_1/params.txt
new file mode 100644
index 0000000..ecc3a9d
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_1/params.txt
@@ -0,0 +1,12 @@
+3
+3
+9
+5
+9
+5
+1
+2
+0
+0
+1
+0
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_2/input.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_2/input.txt
new file mode 100644
index 0000000..855a7bf
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_2/input.txt
@@ -0,0 +1,13 @@
+# 1,1,12,5
+-1.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,-3.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,4.000000000000000000e+00,0.000000000000000000e+00,-7.000000000000000000e+00,5.000000000000000000e+00
+-4.000000000000000000e+00,3.000000000000000000e+00,-4.000000000000000000e+00,5.000000000000000000e+00,-1.000000000000000000e+00
+-5.000000000000000000e+00,-6.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00,6.000000000000000000e+00
+4.000000000000000000e+00,5.000000000000000000e+00,1.000000000000000000e+00,-6.000000000000000000e+00,2.000000000000000000e+00
+-7.000000000000000000e+00,-1.000000000000000000e+00,-5.000000000000000000e+00,-3.000000000000000000e+00,2.000000000000000000e+00
+-4.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00,5.000000000000000000e+00,3.000000000000000000e+00
+-5.000000000000000000e+00,6.000000000000000000e+00,-6.000000000000000000e+00,4.000000000000000000e+00,-4.000000000000000000e+00
+-7.000000000000000000e+00,2.000000000000000000e+00,6.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+6.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+4.000000000000000000e+00,-6.000000000000000000e+00,6.000000000000000000e+00,6.000000000000000000e+00,-3.000000000000000000e+00
+-4.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00,1.000000000000000000e+00,4.000000000000000000e+00
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_2/params.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_2/params.txt
new file mode 100644
index 0000000..de5098a
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_2/params.txt
@@ -0,0 +1,12 @@
+5
+5
+12
+1
+3
+1
+1
+2
+1
+0
+1
+1
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_3/input.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_3/input.txt
new file mode 100644
index 0000000..94144a3
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_3/input.txt
@@ -0,0 +1,10 @@
+# 1,1,9,2
+6.000000000000000000e+00,-3.000000000000000000e+00
+-3.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,2.000000000000000000e+00
+4.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,-4.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00
+6.000000000000000000e+00,-2.000000000000000000e+00
+-7.000000000000000000e+00,-6.000000000000000000e+00
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_3/params.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_3/params.txt
new file mode 100644
index 0000000..ffb1ac3
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_3/params.txt
@@ -0,0 +1,12 @@
+2
+2
+9
+1
+1
+1
+2
+1
+0
+0
+1
+0
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_4/input.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_4/input.txt
new file mode 100644
index 0000000..bf99885
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_4/input.txt
@@ -0,0 +1,21 @@
+# 1,20,1,2
+5.000000000000000000e+00,1.000000000000000000e+00
+4.000000000000000000e+00,-4.000000000000000000e+00
+2.000000000000000000e+00,4.000000000000000000e+00
+-3.000000000000000000e+00,-4.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00
+-5.000000000000000000e+00,5.000000000000000000e+00
+6.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-5.000000000000000000e+00
+-3.000000000000000000e+00,-2.000000000000000000e+00
+-5.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00
+5.000000000000000000e+00,6.000000000000000000e+00
+-5.000000000000000000e+00,-1.000000000000000000e+00
+-7.000000000000000000e+00,-4.000000000000000000e+00
+5.000000000000000000e+00,-2.000000000000000000e+00
+-5.000000000000000000e+00,-4.000000000000000000e+00
+1.000000000000000000e+00,-4.000000000000000000e+00
+3.000000000000000000e+00,5.000000000000000000e+00
+-2.000000000000000000e+00,-4.000000000000000000e+00
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_4/params.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_4/params.txt
new file mode 100644
index 0000000..d361c32
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_4/params.txt
@@ -0,0 +1,12 @@
+2
+2
+1
+20
+1
+3
+1
+3
+0
+0
+1
+1
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_5/input.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_5/input.txt
new file mode 100644
index 0000000..b11640e
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_5/input.txt
@@ -0,0 +1,2 @@
+# 1,1,1,20
+4.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,4.000000000000000000e+00,0.000000000000000000e+00,-6.000000000000000000e+00,-5.000000000000000000e+00,3.000000000000000000e+00,-4.000000000000000000e+00,2.000000000000000000e+00,2.000000000000000000e+00,4.000000000000000000e+00,2.000000000000000000e+00,-5.000000000000000000e+00,5.000000000000000000e+00,6.000000000000000000e+00,2.000000000000000000e+00,-3.000000000000000000e+00,5.000000000000000000e+00
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_5/params.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_5/params.txt
new file mode 100644
index 0000000..a884b1b
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_5/params.txt
@@ -0,0 +1,12 @@
+20
+20
+1
+1
+1
+1
+1
+1
+0
+0
+1
+1
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_6/input.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_6/input.txt
new file mode 100644
index 0000000..9c81b9b
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_6/input.txt
@@ -0,0 +1,6 @@
+# 1,5,1,17
+6.000000000000000000e+00,4.000000000000000000e+00,-7.000000000000000000e+00,-3.000000000000000000e+00,1.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00,4.000000000000000000e+00,-3.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00,6.000000000000000000e+00,0.000000000000000000e+00,-6.000000000000000000e+00,1.000000000000000000e+00,3.000000000000000000e+00,-3.000000000000000000e+00
+3.000000000000000000e+00,6.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00,-7.000000000000000000e+00,6.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00,-4.000000000000000000e+00,-4.000000000000000000e+00,-5.000000000000000000e+00,-7.000000000000000000e+00,-1.000000000000000000e+00,4.000000000000000000e+00
+-5.000000000000000000e+00,6.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00,-5.000000000000000000e+00,-4.000000000000000000e+00,-6.000000000000000000e+00,6.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00,4.000000000000000000e+00,6.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00,5.000000000000000000e+00,-7.000000000000000000e+00,6.000000000000000000e+00
+-6.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00,-3.000000000000000000e+00,-7.000000000000000000e+00,5.000000000000000000e+00,6.000000000000000000e+00,-3.000000000000000000e+00,-5.000000000000000000e+00,5.000000000000000000e+00,-5.000000000000000000e+00,-7.000000000000000000e+00,5.000000000000000000e+00,6.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+-4.000000000000000000e+00,-3.000000000000000000e+00,6.000000000000000000e+00,-3.000000000000000000e+00,3.000000000000000000e+00,4.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00,-6.000000000000000000e+00,4.000000000000000000e+00,0.000000000000000000e+00,6.000000000000000000e+00,2.000000000000000000e+00,0.000000000000000000e+00,-7.000000000000000000e+00,3.000000000000000000e+00
diff --git a/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_6/params.txt b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_6/params.txt
new file mode 100644
index 0000000..31f19e9
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/PregeneratedData/maxpooling_6/params.txt
@@ -0,0 +1,12 @@
+17
+17
+1
+5
+3
+4
+1
+3
+1
+1
+1
+1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling/config_data.h
index db1224e..44172bd 100644
--- a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling/config_data.h
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling/config_data.h
@@ -21,6 +21,7 @@
 // Generated by generate_test_data.py
 #define MAXPOOLING_OUT_CH 8
 #define MAXPOOLING_IN_CH 8
+#define MAXPOOLING_CH_MULT 1  // (Only for depthwise conv)
 #define MAXPOOLING_INPUT_W 22
 #define MAXPOOLING_INPUT_H 12
 #define MAXPOOLING_FILTER_X 6
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/config_data.h
new file mode 100644
index 0000000..f523e8e
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/config_data.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define MAXPOOLING_1_OUT_CH 3
+#define MAXPOOLING_1_IN_CH 3
+#define MAXPOOLING_1_CH_MULT 1  // (Only for depthwise conv)
+#define MAXPOOLING_1_INPUT_W 9
+#define MAXPOOLING_1_INPUT_H 5
+#define MAXPOOLING_1_FILTER_X 9
+#define MAXPOOLING_1_FILTER_Y 5
+#define MAXPOOLING_1_STRIDE_X 1
+#define MAXPOOLING_1_STRIDE_Y 2
+#define MAXPOOLING_1_PAD_X 0
+#define MAXPOOLING_1_PAD_Y 0
+#define MAXPOOLING_1_OUTPUT_W 1
+#define MAXPOOLING_1_OUTPUT_H 1
+#define MAXPOOLING_1_DST_SIZE 3
+#define MAXPOOLING_1_INPUT_SIZE 135
+#define MAXPOOLING_1_INPUT_OFFSET 0
+#define MAXPOOLING_1_OUTPUT_OFFSET 0
+#define MAXPOOLING_1_OUT_ACTIVATION_MIN -128
+#define MAXPOOLING_1_OUT_ACTIVATION_MAX 127
+#define MAXPOOLING_1_INPUT_BATCHES 1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/input_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/input_data.h
new file mode 100644
index 0000000..723c5c1
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/input_data.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+int8_t maxpooling_1_input[135] =
+{
+  80,
+  -16,
+  96,
+  -16,
+  -64,
+  -64,
+  80,
+  -112,
+  -64,
+  -48,
+  -48,
+  -16,
+  16,
+  -64,
+  48,
+  -96,
+  0,
+  -112,
+  80,
+  -112,
+  0,
+  -96,
+  32,
+  32,
+  16,
+  -64,
+  32,
+  -80,
+  -16,
+  64,
+  -64,
+  -16,
+  0,
+  -96,
+  0,
+  -48,
+  -16,
+  16,
+  -48,
+  32,
+  -48,
+  -48,
+  16,
+  32,
+  -32,
+  32,
+  -16,
+  -64,
+  -64,
+  48,
+  16,
+  0,
+  32,
+  -64,
+  96,
+  48,
+  -80,
+  -112,
+  16,
+  0,
+  64,
+  -112,
+  -112,
+  -64,
+  32,
+  64,
+  -48,
+  32,
+  0,
+  96,
+  -112,
+  80,
+  48,
+  -96,
+  16,
+  -32,
+  -32,
+  96,
+  -64,
+  -64,
+  -64,
+  -96,
+  -112,
+  48,
+  -80,
+  32,
+  80,
+  -96,
+  -32,
+  -80,
+  0,
+  96,
+  -80,
+  -64,
+  -80,
+  80,
+  -16,
+  -16,
+  16,
+  -32,
+  -96,
+  0,
+  64,
+  -96,
+  48,
+  -96,
+  64,
+  16,
+  -80,
+  48,
+  32,
+  64,
+  -64,
+  -32,
+  80,
+  0,
+  -112,
+  80,
+  16,
+  -96,
+  -64,
+  0,
+  80,
+  -112,
+  -112,
+  -32,
+  -112,
+  80,
+  0,
+  0,
+  -96,
+  0,
+  -96,
+  16,
+  -32
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/output_ref_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/output_ref_data.h
new file mode 100644
index 0000000..3d9f42a
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/output_ref_data.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int8_t maxpooling_1_output_ref[3] =
+{
+  96,
+  96,
+  96
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/test_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/test_data.h
new file mode 100644
index 0000000..3bce6de
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_1/test_data.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Generated by generate_test_data.py
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "input_data.h"
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/config_data.h
new file mode 100644
index 0000000..acb8c19
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/config_data.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define MAXPOOLING_2_OUT_CH 5
+#define MAXPOOLING_2_IN_CH 5
+#define MAXPOOLING_2_CH_MULT 1  // (Only for depthwise conv)
+#define MAXPOOLING_2_INPUT_W 12
+#define MAXPOOLING_2_INPUT_H 1
+#define MAXPOOLING_2_FILTER_X 3
+#define MAXPOOLING_2_FILTER_Y 1
+#define MAXPOOLING_2_STRIDE_X 1
+#define MAXPOOLING_2_STRIDE_Y 2
+#define MAXPOOLING_2_PAD_X 1
+#define MAXPOOLING_2_PAD_Y 0
+#define MAXPOOLING_2_OUTPUT_W 12
+#define MAXPOOLING_2_OUTPUT_H 1
+#define MAXPOOLING_2_DST_SIZE 60
+#define MAXPOOLING_2_INPUT_SIZE 60
+#define MAXPOOLING_2_INPUT_OFFSET 0
+#define MAXPOOLING_2_OUTPUT_OFFSET 0
+#define MAXPOOLING_2_OUT_ACTIVATION_MIN -128
+#define MAXPOOLING_2_OUT_ACTIVATION_MAX 127
+#define MAXPOOLING_2_INPUT_BATCHES 1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/input_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/input_data.h
new file mode 100644
index 0000000..85b9008
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/input_data.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+int8_t maxpooling_2_input[60] =
+{
+  -16,
+  32,
+  -16,
+  -48,
+  -16,
+  16,
+  64,
+  0,
+  -112,
+  80,
+  -64,
+  48,
+  -64,
+  80,
+  -16,
+  -80,
+  -96,
+  48,
+  32,
+  96,
+  64,
+  80,
+  16,
+  -96,
+  32,
+  -112,
+  -16,
+  -80,
+  -48,
+  32,
+  -64,
+  -32,
+  -16,
+  80,
+  48,
+  -80,
+  96,
+  -96,
+  64,
+  -64,
+  -112,
+  32,
+  96,
+  -16,
+  -16,
+  96,
+  0,
+  -16,
+  -16,
+  -32,
+  64,
+  -96,
+  96,
+  96,
+  -48,
+  -64,
+  -16,
+  32,
+  16,
+  64
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/output_ref_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/output_ref_data.h
new file mode 100644
index 0000000..72b2892
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/output_ref_data.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int8_t maxpooling_2_output_ref[60] =
+{
+  16,
+  64,
+  0,
+  -48,
+  80,
+  16,
+  64,
+  0,
+  80,
+  80,
+  16,
+  64,
+  48,
+  80,
+  96,
+  64,
+  80,
+  48,
+  80,
+  96,
+  64,
+  80,
+  48,
+  32,
+  96,
+  64,
+  80,
+  16,
+  80,
+  48,
+  -64,
+  96,
+  -16,
+  80,
+  48,
+  -64,
+  96,
+  96,
+  80,
+  48,
+  96,
+  96,
+  96,
+  64,
+  -16,
+  96,
+  32,
+  96,
+  96,
+  -16,
+  96,
+  0,
+  96,
+  96,
+  64,
+  64,
+  -16,
+  96,
+  96,
+  64
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/test_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/test_data.h
new file mode 100644
index 0000000..3bce6de
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_2/test_data.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Generated by generate_test_data.py
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "input_data.h"
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/config_data.h
new file mode 100644
index 0000000..5ab9f3e
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/config_data.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define MAXPOOLING_3_OUT_CH 2
+#define MAXPOOLING_3_IN_CH 2
+#define MAXPOOLING_3_CH_MULT 1  // (Only for depthwise conv)
+#define MAXPOOLING_3_INPUT_W 9
+#define MAXPOOLING_3_INPUT_H 1
+#define MAXPOOLING_3_FILTER_X 1
+#define MAXPOOLING_3_FILTER_Y 1
+#define MAXPOOLING_3_STRIDE_X 2
+#define MAXPOOLING_3_STRIDE_Y 1
+#define MAXPOOLING_3_PAD_X 0
+#define MAXPOOLING_3_PAD_Y 0
+#define MAXPOOLING_3_OUTPUT_W 5
+#define MAXPOOLING_3_OUTPUT_H 1
+#define MAXPOOLING_3_DST_SIZE 10
+#define MAXPOOLING_3_INPUT_SIZE 18
+#define MAXPOOLING_3_INPUT_OFFSET 0
+#define MAXPOOLING_3_OUTPUT_OFFSET 0
+#define MAXPOOLING_3_OUT_ACTIVATION_MIN -128
+#define MAXPOOLING_3_OUT_ACTIVATION_MAX 127
+#define MAXPOOLING_3_INPUT_BATCHES 1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/input_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/input_data.h
new file mode 100644
index 0000000..fed9cc3
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/input_data.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+int8_t maxpooling_3_input[18] =
+{
+  96,
+  -48,
+  -48,
+  -32,
+  0,
+  0,
+  16,
+  32,
+  64,
+  16,
+  -32,
+  -64,
+  -64,
+  32,
+  96,
+  -32,
+  -112,
+  -96
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/output_ref_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/output_ref_data.h
new file mode 100644
index 0000000..8868cdb
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/output_ref_data.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int8_t maxpooling_3_output_ref[10] =
+{
+  96,
+  -48,
+  0,
+  0,
+  64,
+  16,
+  -64,
+  32,
+  -112,
+  -96
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/test_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/test_data.h
new file mode 100644
index 0000000..3bce6de
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_3/test_data.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Generated by generate_test_data.py
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "input_data.h"
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/config_data.h
new file mode 100644
index 0000000..3cd2139
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/config_data.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define MAXPOOLING_4_OUT_CH 2
+#define MAXPOOLING_4_IN_CH 2
+#define MAXPOOLING_4_CH_MULT 1  // (Only for depthwise conv)
+#define MAXPOOLING_4_INPUT_W 1
+#define MAXPOOLING_4_INPUT_H 20
+#define MAXPOOLING_4_FILTER_X 1
+#define MAXPOOLING_4_FILTER_Y 3
+#define MAXPOOLING_4_STRIDE_X 1
+#define MAXPOOLING_4_STRIDE_Y 3
+#define MAXPOOLING_4_PAD_X 0
+#define MAXPOOLING_4_PAD_Y 0
+#define MAXPOOLING_4_OUTPUT_W 1
+#define MAXPOOLING_4_OUTPUT_H 7
+#define MAXPOOLING_4_DST_SIZE 14
+#define MAXPOOLING_4_INPUT_SIZE 40
+#define MAXPOOLING_4_INPUT_OFFSET 0
+#define MAXPOOLING_4_OUTPUT_OFFSET 0
+#define MAXPOOLING_4_OUT_ACTIVATION_MIN -128
+#define MAXPOOLING_4_OUT_ACTIVATION_MAX 127
+#define MAXPOOLING_4_INPUT_BATCHES 1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/input_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/input_data.h
new file mode 100644
index 0000000..7163500
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/input_data.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+int8_t maxpooling_4_input[40] =
+{
+  80,
+  16,
+  64,
+  -64,
+  32,
+  64,
+  -48,
+  -64,
+  -64,
+  32,
+  -80,
+  80,
+  96,
+  0,
+  -16,
+  -32,
+  16,
+  -80,
+  -48,
+  -32,
+  -80,
+  -32,
+  0,
+  16,
+  80,
+  96,
+  -80,
+  -16,
+  -112,
+  -64,
+  80,
+  -32,
+  -80,
+  -64,
+  16,
+  -64,
+  48,
+  80,
+  -32,
+  -64
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/output_ref_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/output_ref_data.h
new file mode 100644
index 0000000..df04fe7
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/output_ref_data.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int8_t maxpooling_4_output_ref[14] =
+{
+  80,
+  64,
+  -48,
+  80,
+  96,
+  0,
+  0,
+  16,
+  80,
+  96,
+  80,
+  -32,
+  48,
+  80
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/test_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/test_data.h
new file mode 100644
index 0000000..3bce6de
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_4/test_data.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Generated by generate_test_data.py
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "input_data.h"
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/config_data.h
new file mode 100644
index 0000000..150adfe
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/config_data.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define MAXPOOLING_5_OUT_CH 20
+#define MAXPOOLING_5_IN_CH 20
+#define MAXPOOLING_5_CH_MULT 1  // (Only for depthwise conv)
+#define MAXPOOLING_5_INPUT_W 1
+#define MAXPOOLING_5_INPUT_H 1
+#define MAXPOOLING_5_FILTER_X 1
+#define MAXPOOLING_5_FILTER_Y 1
+#define MAXPOOLING_5_STRIDE_X 1
+#define MAXPOOLING_5_STRIDE_Y 1
+#define MAXPOOLING_5_PAD_X 0
+#define MAXPOOLING_5_PAD_Y 0
+#define MAXPOOLING_5_OUTPUT_W 1
+#define MAXPOOLING_5_OUTPUT_H 1
+#define MAXPOOLING_5_DST_SIZE 20
+#define MAXPOOLING_5_INPUT_SIZE 20
+#define MAXPOOLING_5_INPUT_OFFSET 0
+#define MAXPOOLING_5_OUTPUT_OFFSET 0
+#define MAXPOOLING_5_OUT_ACTIVATION_MIN -128
+#define MAXPOOLING_5_OUT_ACTIVATION_MAX 127
+#define MAXPOOLING_5_INPUT_BATCHES 1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/input_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/input_data.h
new file mode 100644
index 0000000..c5f44ab
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/input_data.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+int8_t maxpooling_5_input[20] =
+{
+  64,
+  0,
+  0,
+  -16,
+  64,
+  0,
+  -96,
+  -80,
+  48,
+  -64,
+  32,
+  32,
+  64,
+  32,
+  -80,
+  80,
+  96,
+  32,
+  -48,
+  80
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/output_ref_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/output_ref_data.h
new file mode 100644
index 0000000..0043132
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/output_ref_data.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int8_t maxpooling_5_output_ref[20] =
+{
+  64,
+  0,
+  0,
+  -16,
+  64,
+  0,
+  -96,
+  -80,
+  48,
+  -64,
+  32,
+  32,
+  64,
+  32,
+  -80,
+  80,
+  96,
+  32,
+  -48,
+  80
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/test_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/test_data.h
new file mode 100644
index 0000000..3bce6de
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_5/test_data.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Generated by generate_test_data.py
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "input_data.h"
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/config_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/config_data.h
new file mode 100644
index 0000000..e81997c
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/config_data.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define MAXPOOLING_6_OUT_CH 17
+#define MAXPOOLING_6_IN_CH 17
+#define MAXPOOLING_6_CH_MULT 1  // (Only for depthwise conv)
+#define MAXPOOLING_6_INPUT_W 1
+#define MAXPOOLING_6_INPUT_H 5
+#define MAXPOOLING_6_FILTER_X 3
+#define MAXPOOLING_6_FILTER_Y 4
+#define MAXPOOLING_6_STRIDE_X 1
+#define MAXPOOLING_6_STRIDE_Y 3
+#define MAXPOOLING_6_PAD_X 1
+#define MAXPOOLING_6_PAD_Y 1
+#define MAXPOOLING_6_OUTPUT_W 1
+#define MAXPOOLING_6_OUTPUT_H 2
+#define MAXPOOLING_6_DST_SIZE 34
+#define MAXPOOLING_6_INPUT_SIZE 85
+#define MAXPOOLING_6_INPUT_OFFSET 0
+#define MAXPOOLING_6_OUTPUT_OFFSET 0
+#define MAXPOOLING_6_OUT_ACTIVATION_MIN -128
+#define MAXPOOLING_6_OUT_ACTIVATION_MAX 127
+#define MAXPOOLING_6_INPUT_BATCHES 1
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/input_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/input_data.h
new file mode 100644
index 0000000..4d3deed
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/input_data.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+int8_t maxpooling_6_input[85] =
+{
+  96,
+  64,
+  -112,
+  -48,
+  16,
+  48,
+  32,
+  64,
+  -48,
+  48,
+  32,
+  96,
+  0,
+  -96,
+  16,
+  48,
+  -48,
+  48,
+  96,
+  0,
+  16,
+  0,
+  -64,
+  -112,
+  96,
+  -48,
+  -64,
+  -16,
+  -64,
+  -64,
+  -80,
+  -112,
+  -16,
+  64,
+  -80,
+  96,
+  16,
+  -32,
+  -80,
+  -64,
+  -96,
+  96,
+  -16,
+  -32,
+  64,
+  96,
+  -32,
+  -32,
+  80,
+  -112,
+  96,
+  -96,
+  32,
+  -16,
+  32,
+  -48,
+  -112,
+  80,
+  96,
+  -48,
+  -80,
+  80,
+  -80,
+  -112,
+  80,
+  96,
+  -16,
+  -32,
+  -64,
+  -48,
+  96,
+  -48,
+  48,
+  64,
+  -64,
+  -16,
+  -16,
+  -96,
+  64,
+  0,
+  96,
+  32,
+  0,
+  -112,
+  48
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/output_ref_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/output_ref_data.h
new file mode 100644
index 0000000..7bb1aa7
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/output_ref_data.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int8_t maxpooling_6_output_ref[34] =
+{
+  96,
+  96,
+  16,
+  16,
+  16,
+  48,
+  32,
+  96,
+  -16,
+  48,
+  64,
+  96,
+  0,
+  -32,
+  80,
+  48,
+  96,
+  -64,
+  96,
+  96,
+  32,
+  48,
+  64,
+  80,
+  96,
+  -16,
+  -32,
+  80,
+  96,
+  96,
+  80,
+  96,
+  -16,
+  96
+};
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/test_data.h b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/test_data.h
new file mode 100644
index 0000000..3bce6de
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/TestData/maxpooling_6/test_data.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+// Generated by generate_test_data.py
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "input_data.h"
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8_opt/Unity/unity_test_arm_max_pool_s8_opt.c b/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8/Unity/unity_test_arm_max_pool_s8.c
similarity index 63%
rename from CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8_opt/Unity/unity_test_arm_max_pool_s8_opt.c
rename to CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8/Unity/unity_test_arm_max_pool_s8.c
index a12f3d5..378b51e 100644
--- a/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8_opt/Unity/unity_test_arm_max_pool_s8_opt.c
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8/Unity/unity_test_arm_max_pool_s8.c
@@ -23,7 +23,7 @@
 #include <stdbool.h>
 
 #include "unity.h"
-#include "../test_arm_max_pool_s8_opt.c"
+#include "../test_arm_max_pool_s8.c"
 
 /* This function is called from the autogenerated file.
  * The name must be exactly like this
@@ -41,7 +41,37 @@
 
 }
 
-void test_avgpooling_arm_max_pool_s8_opt(void)
+void test_maxpooling_arm_max_pool_s8(void)
 {
-  maxpooling_arm_max_pool_s8_opt();
+  maxpooling_arm_max_pool_s8();
+}
+
+void test_maxpooling_1_arm_max_pool_s8(void)
+{
+  maxpooling_1_arm_max_pool_s8();
+}
+
+void test_maxpooling_2_arm_max_pool_s8(void)
+{
+  maxpooling_2_arm_max_pool_s8();
+}
+
+void test_maxpooling_3_arm_max_pool_s8(void)
+{
+  maxpooling_3_arm_max_pool_s8();
+}
+
+void test_maxpooling_4_arm_max_pool_s8(void)
+{
+  maxpooling_4_arm_max_pool_s8();
+}
+
+void test_maxpooling_5_arm_max_pool_s8(void)
+{
+  maxpooling_5_arm_max_pool_s8();
+}
+
+void test_maxpooling_6_arm_max_pool_s8(void)
+{
+  maxpooling_6_arm_max_pool_s8();
 }
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8/test_arm_max_pool_s8.c b/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8/test_arm_max_pool_s8.c
new file mode 100644
index 0000000..da1d9a1
--- /dev/null
+++ b/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8/test_arm_max_pool_s8.c
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <arm_nnfunctions.h>
+
+#include "../Utils/validate.h"
+#include "../TestData/maxpooling/test_data.h"
+#include "../TestData/maxpooling_1/test_data.h"
+#include "../TestData/maxpooling_2/test_data.h"
+#include "../TestData/maxpooling_3/test_data.h"
+#include "../TestData/maxpooling_4/test_data.h"
+#include "../TestData/maxpooling_5/test_data.h"
+#include "../TestData/maxpooling_6/test_data.h"
+
+#define REPEAT_NUM (2)
+
+void maxpooling_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_input;
+
+  input_dims.n = MAXPOOLING_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_INPUT_W;
+  input_dims.h = MAXPOOLING_INPUT_H;
+  input_dims.c = MAXPOOLING_IN_CH;
+  filter_dims.w = MAXPOOLING_FILTER_X;
+  filter_dims.h = MAXPOOLING_FILTER_Y;
+  output_dims.w = MAXPOOLING_OUTPUT_W;
+  output_dims.h = MAXPOOLING_OUTPUT_H;
+  output_dims.c = MAXPOOLING_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_PAD_X;
+  pool_params.padding.h = MAXPOOLING_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_output_ref, MAXPOOLING_DST_SIZE));
+  }
+}
+
+void maxpooling_1_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_1_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_1_input;
+
+  input_dims.n = MAXPOOLING_1_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_1_INPUT_W;
+  input_dims.h = MAXPOOLING_1_INPUT_H;
+  input_dims.c = MAXPOOLING_1_IN_CH;
+  filter_dims.w = MAXPOOLING_1_FILTER_X;
+  filter_dims.h = MAXPOOLING_1_FILTER_Y;
+  output_dims.w = MAXPOOLING_1_OUTPUT_W;
+  output_dims.h = MAXPOOLING_1_OUTPUT_H;
+  output_dims.c = MAXPOOLING_1_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_1_PAD_X;
+  pool_params.padding.h = MAXPOOLING_1_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_1_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_1_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_1_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_1_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_1_output_ref, MAXPOOLING_1_DST_SIZE));
+  }
+}
+
+void maxpooling_2_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_2_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_2_input;
+
+  input_dims.n = MAXPOOLING_2_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_2_INPUT_W;
+  input_dims.h = MAXPOOLING_2_INPUT_H;
+  input_dims.c = MAXPOOLING_2_IN_CH;
+  filter_dims.w = MAXPOOLING_2_FILTER_X;
+  filter_dims.h = MAXPOOLING_2_FILTER_Y;
+  output_dims.w = MAXPOOLING_2_OUTPUT_W;
+  output_dims.h = MAXPOOLING_2_OUTPUT_H;
+  output_dims.c = MAXPOOLING_2_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_2_PAD_X;
+  pool_params.padding.h = MAXPOOLING_2_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_2_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_2_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_2_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_2_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_2_output_ref, MAXPOOLING_2_DST_SIZE));
+  }
+}
+
+void maxpooling_3_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_3_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_3_input;
+
+  input_dims.n = MAXPOOLING_3_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_3_INPUT_W;
+  input_dims.h = MAXPOOLING_3_INPUT_H;
+  input_dims.c = MAXPOOLING_3_IN_CH;
+  filter_dims.w = MAXPOOLING_3_FILTER_X;
+  filter_dims.h = MAXPOOLING_3_FILTER_Y;
+  output_dims.w = MAXPOOLING_3_OUTPUT_W;
+  output_dims.h = MAXPOOLING_3_OUTPUT_H;
+  output_dims.c = MAXPOOLING_3_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_3_PAD_X;
+  pool_params.padding.h = MAXPOOLING_3_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_3_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_3_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_3_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_3_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_3_output_ref, MAXPOOLING_3_DST_SIZE));
+  }
+}
+
+void maxpooling_4_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_4_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_4_input;
+
+  input_dims.n = MAXPOOLING_4_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_4_INPUT_W;
+  input_dims.h = MAXPOOLING_4_INPUT_H;
+  input_dims.c = MAXPOOLING_4_IN_CH;
+  filter_dims.w = MAXPOOLING_4_FILTER_X;
+  filter_dims.h = MAXPOOLING_4_FILTER_Y;
+  output_dims.w = MAXPOOLING_4_OUTPUT_W;
+  output_dims.h = MAXPOOLING_4_OUTPUT_H;
+  output_dims.c = MAXPOOLING_4_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_4_PAD_X;
+  pool_params.padding.h = MAXPOOLING_4_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_4_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_4_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_4_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_4_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_4_output_ref, MAXPOOLING_4_DST_SIZE));
+  }
+}
+
+void maxpooling_5_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_5_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_5_input;
+
+  input_dims.n = MAXPOOLING_5_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_5_INPUT_W;
+  input_dims.h = MAXPOOLING_5_INPUT_H;
+  input_dims.c = MAXPOOLING_5_IN_CH;
+  filter_dims.w = MAXPOOLING_5_FILTER_X;
+  filter_dims.h = MAXPOOLING_5_FILTER_Y;
+  output_dims.w = MAXPOOLING_5_OUTPUT_W;
+  output_dims.h = MAXPOOLING_5_OUTPUT_H;
+  output_dims.c = MAXPOOLING_5_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_5_PAD_X;
+  pool_params.padding.h = MAXPOOLING_5_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_5_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_5_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_5_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_5_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_5_output_ref, MAXPOOLING_5_DST_SIZE));
+  }
+}
+
+void maxpooling_6_arm_max_pool_s8(void)
+{
+  const arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[MAXPOOLING_6_DST_SIZE] = {0};
+
+  cmsis_nn_context ctx;
+  cmsis_nn_pool_params pool_params;
+  cmsis_nn_dims input_dims;
+  cmsis_nn_dims filter_dims;
+  cmsis_nn_dims output_dims;
+
+  const q7_t *input_data = maxpooling_6_input;
+
+  input_dims.n = MAXPOOLING_6_INPUT_BATCHES;
+  input_dims.w = MAXPOOLING_6_INPUT_W;
+  input_dims.h = MAXPOOLING_6_INPUT_H;
+  input_dims.c = MAXPOOLING_6_IN_CH;
+  filter_dims.w = MAXPOOLING_6_FILTER_X;
+  filter_dims.h = MAXPOOLING_6_FILTER_Y;
+  output_dims.w = MAXPOOLING_6_OUTPUT_W;
+  output_dims.h = MAXPOOLING_6_OUTPUT_H;
+  output_dims.c = MAXPOOLING_6_OUT_CH;
+
+  pool_params.padding.w = MAXPOOLING_6_PAD_X;
+  pool_params.padding.h = MAXPOOLING_6_PAD_Y;
+  pool_params.stride.w = MAXPOOLING_6_STRIDE_X;
+  pool_params.stride.h = MAXPOOLING_6_STRIDE_Y;
+
+  pool_params.activation.min = MAXPOOLING_6_OUT_ACTIVATION_MIN;
+  pool_params.activation.max = MAXPOOLING_6_OUT_ACTIVATION_MAX;
+
+  for (int i = 0; i < REPEAT_NUM; i++)
+  {
+    arm_status result = arm_max_pool_s8(&ctx,
+                                        &pool_params,
+                                        &input_dims,
+                                        input_data,
+                                        &filter_dims,
+                                        &output_dims,
+                                        output);
+
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, maxpooling_6_output_ref, MAXPOOLING_6_DST_SIZE));
+  }
+}
\ No newline at end of file
diff --git a/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8_opt/test_arm_max_pool_s8_opt.c b/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8_opt/test_arm_max_pool_s8_opt.c
deleted file mode 100644
index bbdaf2f..0000000
--- a/CMSIS/NN/Tests/UnitTest/TestCases/test_arm_max_pool_s8_opt/test_arm_max_pool_s8_opt.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the License); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <arm_nnfunctions.h>
-
-#include "../Utils/validate.h"
-#include "../TestData/maxpooling/test_data.h"
-
-
-void maxpooling_arm_max_pool_s8_opt(void)
-{
-  q7_t output[MAXPOOLING_DST_SIZE] = {0};
-  const arm_status expected = ARM_MATH_SUCCESS;
-
-  arm_status result = arm_max_pool_s8_opt(MAXPOOLING_INPUT_H,
-                                          MAXPOOLING_INPUT_W,
-                                          MAXPOOLING_OUTPUT_H,
-                                          MAXPOOLING_OUTPUT_W,
-                                          MAXPOOLING_STRIDE_Y,
-                                          MAXPOOLING_STRIDE_X,
-                                          MAXPOOLING_FILTER_Y,
-                                          MAXPOOLING_FILTER_X,
-                                          MAXPOOLING_PAD_Y,
-                                          MAXPOOLING_PAD_X,
-                                          MAXPOOLING_OUT_ACTIVATION_MIN,
-                                          MAXPOOLING_OUT_ACTIVATION_MAX,
-                                          MAXPOOLING_IN_CH,
-                                          maxpooling_input,
-                                          NULL,
-                                          output);
-  TEST_ASSERT_EQUAL(expected, result);
-  TEST_ASSERT_TRUE(validate(output, maxpooling_output_ref, MAXPOOLING_DST_SIZE));
-}
diff --git a/CMSIS/NN/Tests/UnitTest/generate_test_data.py b/CMSIS/NN/Tests/UnitTest/generate_test_data.py
index 146b458..c74cdd2 100755
--- a/CMSIS/NN/Tests/UnitTest/generate_test_data.py
+++ b/CMSIS/NN/Tests/UnitTest/generate_test_data.py
@@ -639,6 +639,11 @@
         # avgpooling_3
         # generator = PoolingSettings(args, channels=2, x_in= 9, y_in=1, stride_x=2, stride_y=1, w_x=1, w_y=1, pad=False)
         # avgpooling_4
-        generator = PoolingSettings(args, channels=2, x_in= 1, y_in=20, stride_x=1, stride_y=3, w_x=1, w_y=3, pad=True)
+        # generator = PoolingSettings(args, channels=2, x_in= 1, y_in=20, stride_x=1, stride_y=3, w_x=1, w_y=3, pad=True)
+        # avgpooling_5
+        # generator = PoolingSettings(args, channels=20, x_in= 1, y_in=1, stride_x=1, stride_y=1, w_x=1, w_y=1, pad=True)
+        # avgpooling_6
+        generator = PoolingSettings(args, channels=17, x_in= 1, y_in=5, stride_x=1, stride_y=3, w_x=3, w_y=4, pad=True)
+
 
     generator.generate_data()