Add dynamic tensor support to CpuElementwise

The kernels and operators for binary and unary operations
are now capable of being configured with dynamic shapes and
computing windows at run-time.

Additionally, changing arguments' names is done
for consistency.

Partially Implements: COMPMID-4127

Change-Id: I48e5038692db667dec7cb2b2906fe5683214fe19
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4973
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Marquez Tello <pablo.tello@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/tests/validation/fixtures/ElementWiseUnaryFixture.h b/tests/validation/fixtures/ElementWiseUnaryFixture.h
index 8cffef4..9729907 100644
--- a/tests/validation/fixtures/ElementWiseUnaryFixture.h
+++ b/tests/validation/fixtures/ElementWiseUnaryFixture.h
@@ -44,11 +44,12 @@
 {
 public:
     template <typename...>
-    void setup(TensorShape input_shape, DataType input_data_type, bool in_place, ElementWiseUnary op)
+    void setup(TensorShape input_shape, DataType input_data_type, bool in_place, ElementWiseUnary op, bool use_dynamic_shape = false)
     {
-        _op        = op;
-        _target    = compute_target(input_shape, input_data_type, in_place);
-        _reference = compute_reference(input_shape, input_data_type);
+        _op                = op;
+        _target            = compute_target(input_shape, input_data_type, in_place);
+        _reference         = compute_reference(input_shape, input_data_type);
+        _use_dynamic_shape = use_dynamic_shape;
     }
 
 protected:
@@ -131,10 +132,24 @@
 
         TensorType *actual_dst = in_place ? &src : &dst;
 
+        // if _use_dynamic_shape is true, this fixture will test scenario for dynamic shapes.
+        // - At configure time, all input tensors are marked as dynamic using set_tensor_dynamic()
+        // - After configure, tensors are marked as static for run using set_tensor_static()
+        // - The tensors with static shape are given to run()
+        if(_use_dynamic_shape)
+        {
+            set_tensor_dynamic(src);
+        }
+
         // Create and configure function
         FunctionType elwiseunary_layer;
         elwiseunary_layer.configure(&src, actual_dst);
 
+        if(_use_dynamic_shape)
+        {
+            set_tensor_static(src);
+        }
+
         ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
         src.allocator()->allocate();
         ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -175,6 +190,7 @@
     TensorType       _target{};
     SimpleTensor<T>  _reference{};
     ElementWiseUnary _op{};
+    bool             _use_dynamic_shape{ false };
 };
 
 template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
@@ -189,6 +205,17 @@
 };
 
 template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class RsqrtDynamicShapeValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+    template <typename...>
+    void setup(const TensorShape &shape, DataType data_type)
+    {
+        ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, false, ElementWiseUnary::RSQRT, true);
+    }
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
 class ExpValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
 {
 public: