Ensure that correct transformed matrices are used in CpuFullyConnected

Execution pack of CpuFullyConnected was altered explicitly with local
objects that were getting out of scope. Leading to incorrect results or
memory related issues.

Track transformed weights and register the weights matrix explicitly
during execution honoring the object lifetime scope.

Resolves: COMPMID-4762, COMPMID-4764

Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I53449c377fb1cfccdf5e6f9505d963518748c318
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/349345
Tested-by: bsgcomp <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Comments-Addressed: bsgcomp <bsgcomp@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6092
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/src/runtime/cpu/operators/CpuFullyConnected.h b/src/runtime/cpu/operators/CpuFullyConnected.h
index 954a7b7..498ceae 100644
--- a/src/runtime/cpu/operators/CpuFullyConnected.h
+++ b/src/runtime/cpu/operators/CpuFullyConnected.h
@@ -128,14 +128,16 @@
     std::unique_ptr<CpuGemm>                         _mm_gemm;
     std::unique_ptr<CpuGemmLowpMatrixMultiplyCore>   _mm_gemmlowp;
 
-    TensorInfo _flattened_src;
-    TensorInfo _converted_weights;
-    TensorInfo _reshaped_weights;
+    TensorInfo   _flattened_src;
+    TensorInfo   _converted_weights;
+    TensorInfo   _reshaped_weights;
+    TensorInfo   _trans_weights;
+    AuxTensorIdx _trans_weights_idx;
 
     experimental::MemoryRequirements _aux_mem;
 
-    bool _are_weights_converted;
-    bool _are_weights_reshaped;
+    bool _needs_weights_conversion;
+    bool _needs_weights_reshape;
     bool _is_fc_after_conv;
     bool _is_quantized_asymmetric;
     bool _is_prepared;