COMPMID-556: Rework CLActivationLayer

Refactoring.

Change-Id: I879353299b655ec3026cccdfcfca2ee98abf14ea
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94191
Reviewed-by: Michel Iwaniec <michel.iwaniec@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
diff --git a/arm_compute/core/Helpers.h b/arm_compute/core/Helpers.h
index 6e4d987..edb05e9 100644
--- a/arm_compute/core/Helpers.h
+++ b/arm_compute/core/Helpers.h
@@ -466,10 +466,15 @@
  * @param[in]     num_channels         New number of channels.
  * @param[in]     data_type            New data type
  * @param[in]     fixed_point_position New fixed point position
+ * @param[in]     quantization_info    (Optional) New quantization info
  *
  * @return True if the tensor info has been initialized
  */
-bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, int fixed_point_position);
+bool auto_init_if_empty(ITensorInfo       &info,
+                        const TensorShape &shape,
+                        int num_channels, DataType data_type,
+                        int              fixed_point_position,
+                        QuantizationInfo quantization_info = QuantizationInfo());
 
 /* Set the shape to the specified value if the current assignment is empty.
  *
@@ -509,6 +514,17 @@
  * @return True if the fixed point position has been changed.
  */
 bool set_fixed_point_position_if_zero(ITensorInfo &info, int fixed_point_position);
+
+/* Set the quantization info to the specified value if
+ * the current quantization info is empty and the data type of asymmetric quantized type
+ *
+ * @param[in,out] info              Tensor info used to check and assign.
+ * @param[in]     quantization_info Quantization info
+ *
+ * @return True if the quantization info has been changed.
+ */
+bool set_quantization_info_if_empty(ITensorInfo &info, QuantizationInfo quantization_info);
+
 /** Helper function to calculate the Valid Region for Scale.
  *
  * @param[in] src_info         Input tensor info used to check.
@@ -520,6 +536,7 @@
  * @return The corrispondent valid region
  */
 ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy policy, BorderSize border_size, bool border_undefined);
+
 /** Convert a linear index into n-dimensional coordinates.
  *
  * @param[in] shape Shape of the n-dimensional tensor.
@@ -528,6 +545,7 @@
  * @return n-dimensional coordinates.
  */
 inline Coordinates index2coords(const TensorShape &shape, int index);
+
 /** Convert n-dimensional coordinates into a linear index.
  *
  * @param[in] shape Shape of the n-dimensional tensor.
diff --git a/arm_compute/core/Helpers.inl b/arm_compute/core/Helpers.inl
index de6c85e..1a27684 100644
--- a/arm_compute/core/Helpers.inl
+++ b/arm_compute/core/Helpers.inl
@@ -197,7 +197,12 @@
     }
 }
 
-inline bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, int fixed_point_position)
+inline bool auto_init_if_empty(ITensorInfo       &info,
+                               const TensorShape &shape,
+                               int                num_channels,
+                               DataType           data_type,
+                               int                fixed_point_position,
+                               QuantizationInfo   quantization_info)
 {
     if(info.tensor_shape().total_size() == 0)
     {
@@ -205,6 +210,7 @@
         info.set_num_channels(num_channels);
         info.set_tensor_shape(shape);
         info.set_fixed_point_position(fixed_point_position);
+        info.set_quantization_info(quantization_info);
         return true;
     }
 
@@ -255,6 +261,17 @@
     return false;
 }
 
+inline bool set_quantization_info_if_empty(ITensorInfo &info, QuantizationInfo quantization_info)
+{
+    if(info.quantization_info().empty() && (is_data_type_assymetric(info.data_type())))
+    {
+        info.set_quantization_info(quantization_info);
+        return true;
+    }
+
+    return false;
+}
+
 inline ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy policy, BorderSize border_size, bool border_undefined)
 {
     const auto  wr = static_cast<float>(dst_shape[0]) / static_cast<float>(src_info.tensor_shape()[0]);
diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h
index 149e404..8e15a0a 100644
--- a/arm_compute/core/Utils.h
+++ b/arm_compute/core/Utils.h
@@ -708,6 +708,28 @@
     }
 }
 
+/** Check if a given data type is of quantized type
+ *
+ * @note Quantized is considered a super-set of fixed-point and asymmetric data types.
+ *
+ * @param[in] dt Input data type.
+ *
+ * @return True if data type is of quantized type, else false.
+ */
+inline bool is_data_type_quantized(DataType dt)
+{
+    switch(dt)
+    {
+        case DataType::QS8:
+        case DataType::QASYMM8:
+        case DataType::QS16:
+        case DataType::QS32:
+            return true;
+        default:
+            return false;
+    }
+}
+
 /** Check if a given data type is of fixed point type
  *
  * @param[in] dt Input data type.
@@ -727,6 +749,23 @@
     }
 }
 
+/** Check if a given data type is of asymmetric quantized type
+ *
+ * @param[in] dt Input data type.
+ *
+ * @return True if data type is of symmetric quantized type, else false.
+ */
+inline bool is_data_type_assymetric(DataType dt)
+{
+    switch(dt)
+    {
+        case DataType::QASYMM8:
+            return true;
+        default:
+            return false;
+    }
+}
+
 /** Create a string with the float in full precision.
  *
  * @param val Floating point value