IVGCVSW-7209 Remove deprecated code due to be removed in 23.02

* Removed weights and bias from Convolution, DepthwiseConv & FullyConnected
  layers
* Removed the weight and bias ConstTensorHandles from the QueueDescriptors
* Updated Workloads to take tensors from WorkloadInfo rather than the
  QueueDescriptors
* Removed unused RedirectMembersToConstantInputs optimization and tests.

Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I9ffcdc4a1c0dff725539dd69fc435b700bd98a56
diff --git a/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
index 1e0adc1..8a2d8c8 100644
--- a/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
@@ -1,5 +1,5 @@
 //
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
 // SPDX-License-Identifier: MIT
 //
 
@@ -313,8 +313,6 @@
 
     armnn::Convolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-    armnn::ScopedTensorHandle biasTensor(biasDesc);
 
     // Permute the kernel if necessary
     std::vector<T> kernel = originalKernel;
@@ -322,12 +320,6 @@
     {
         armnnUtils::Permute(kernelDesc.GetShape(), NCHWToNHWC, originalKernel.data(), kernel.data(), sizeof(T));
     }
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernel.data());
-
-    if(biasEnabled)
-    {
-        AllocateAndCopyDataToITensorHandle(&biasTensor, bias.data());
-    }
 
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
     AddInputToWorkload(data, info, kernelDesc, weightsHandle.get());
@@ -339,8 +331,6 @@
         biasHandle = tensorHandleFactory.CreateTensorHandle(biasDesc);
         AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     }
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor; // Still set this whether or not bias is enabled - can be a source of bugs.
     data.m_Parameters.m_StrideX = strideX;
     data.m_Parameters.m_StrideY = strideY;
     data.m_Parameters.m_PadLeft = padLeft;
@@ -442,15 +432,13 @@
     std::unique_ptr<armnn::ITensorHandle> weightsHandle = tensorHandleFactory.CreateTensorHandle(kernelDesc);
     std::unique_ptr<armnn::ITensorHandle> biasHandle = nullptr;
 
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernel.data());
+//    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
+//    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernel.data());
 
-    armnn::ScopedTensorHandle biasTensor(biasDesc);
+//    armnn::ScopedTensorHandle biasTensor(biasDesc);
 
     armnn::Convolution2dQueueDescriptor data;
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor; // Still set this whether or not bias is enabled - can be a source of bugs.
     data.m_Parameters.m_StrideX = strideX;
     data.m_Parameters.m_StrideY = strideY;
     data.m_Parameters.m_PadLeft = padLeft;
@@ -590,18 +578,16 @@
 
     armnn::Convolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
-    armnn::ScopedTensorHandle weightsTensor(kernelInfo);
-    armnn::ScopedTensorHandle biasTensor(biasInfo);
-
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernelData.data());
-    AllocateAndCopyDataToITensorHandle(&biasTensor, biasData.data());
+//    armnn::ScopedTensorHandle weightsTensor(kernelInfo);
+//    armnn::ScopedTensorHandle biasTensor(biasInfo);
+//
+//    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernelData.data());
+//    AllocateAndCopyDataToITensorHandle(&biasTensor, biasData.data());
 
     AddInputToWorkload(data, info, inputInfo, inputHandle.get());
     AddInputToWorkload(data, info, kernelInfo, weightsHandle.get());
     AddOutputToWorkload(data, info, outputInfo, outputHandle.get());
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor;
     data.m_Parameters.m_StrideX = 1;
     data.m_Parameters.m_StrideY = stride;
     data.m_Parameters.m_PadLeft = 0;
@@ -1421,25 +1407,14 @@
     armnn::Convolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
 
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-    armnn::ScopedTensorHandle biasTensor(biasDesc);
-
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
     AddInputToWorkload(data, info, kernelDesc, weightsHandle.get());
     AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
 
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // See comment in DepthwiseConvolution2dAsymmetricTestImpl() for reasons.
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), kernel.data());
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernel.data());
     AllocateAndCopyDataToITensorHandle(biasHandle.get(), bias.data());
-    AllocateAndCopyDataToITensorHandle(&biasTensor, bias.data());
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor;
     data.m_Parameters.m_StrideX = strideX;
     data.m_Parameters.m_StrideY = strideY;
     data.m_Parameters.m_PadLeft = padX;
@@ -1827,15 +1802,6 @@
     armnn::DepthwiseConvolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
 
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    //    Needed in Neon and Cl Workload when permuting. Backend TensorHandle in (2) below will not work.
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
-    //    Cannot PolymorphicDowncast from ScopedTensorHandle->RefTensorHandle.
-    //    Need to PolymorphicDowncast from ITensorHandle->RefTensorHandle.
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernelData.data());
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), kernelData.data()); // required for ConstantTensor
 
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
@@ -1852,8 +1818,6 @@
         AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     }
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor; // Still set this whether or not bias is enabled - it can be a source of bugs.
     data.m_Parameters.m_StrideX = strideX;
     data.m_Parameters.m_StrideY = strideY;
     data.m_Parameters.m_PadLeft = padLeft;
@@ -2009,12 +1973,6 @@
     armnn::DepthwiseConvolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
 
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // See comment in DepthwiseConvolution2dAsymmetricTestImpl() for reasons.
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernelData.data()); // required for QueueDescriptor
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), kernelData.data()); // required for ConstantTensor
 
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
@@ -2031,8 +1989,6 @@
         AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     }
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor; // Still set this whether or not bias is enabled.
     data.m_Parameters.m_StrideX = 1;
     data.m_Parameters.m_StrideY = 1;
     data.m_Parameters.m_PadLeft = 0;
@@ -2234,12 +2190,6 @@
     armnn::DepthwiseConvolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
 
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // See comment in DepthwiseConvolution2dAsymmetricTestImpl() for reasons.
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernelData.data()); // required for QueueDescriptor
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), kernelData.data()); // required for ConstantTensor
 
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
@@ -2256,8 +2206,6 @@
         AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     }
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor; // Still set this whether or not bias is enabled.
     data.m_Parameters.m_StrideX = 2;
     data.m_Parameters.m_StrideY = 1;
     data.m_Parameters.m_PadLeft = 0;
@@ -2426,12 +2374,6 @@
     armnn::DepthwiseConvolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
 
-    armnn::ScopedTensorHandle weightsTensor(kernelDesc);
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // See comment in DepthwiseConvolution2dAsymmetricTestImpl() for reasons.
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, kernelData.data()); // required for QueueDescriptor
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), kernelData.data()); // required for ConstantTensor
 
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
@@ -2448,8 +2390,6 @@
         AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     }
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor; // Still set this whether or not bias is enabled - can be a source of bugs.
     data.m_Parameters.m_StrideX = strideX;
     data.m_Parameters.m_StrideY = strideY;
     data.m_Parameters.m_PadLeft = padLeft;
@@ -3177,25 +3117,14 @@
     armnn::DepthwiseConvolution2dQueueDescriptor data;
     armnn::WorkloadInfo info;
 
-    armnn::ScopedTensorHandle weightsTensor(aclKernelDescriptor);
-    armnn::ScopedTensorHandle biasTensor(biasDesc);
-
     AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get());
     AddInputToWorkload(data, info, aclKernelDescriptor, weightsHandle.get());
     AddInputToWorkload(data, info, biasDesc, biasHandle.get());
     AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
 
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // See comment in DepthwiseConvolution2dAsymmetricTestImpl() for reasons.
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), aclKernelData.data());
-    AllocateAndCopyDataToITensorHandle(&weightsTensor, aclKernelData.data());
     AllocateAndCopyDataToITensorHandle(biasHandle.get(), bias.data());
-    AllocateAndCopyDataToITensorHandle(&biasTensor, bias.data());
 
-    data.m_Weight = &weightsTensor;
-    data.m_Bias = &biasTensor;
     data.m_Parameters.m_StrideX = strideX;
     data.m_Parameters.m_StrideY = strideY;
     data.m_Parameters.m_PadLeft = padX;
@@ -3696,16 +3625,14 @@
     std::unique_ptr<armnn::ITensorHandle> biasHandle = nullptr;
 
     WorkloadInfo workloadInfo;
-    ScopedTensorHandle weightTensor(kernelInfo);
-    ScopedTensorHandle biasTensor(biasInfo);
-
-    AllocateAndCopyDataToITensorHandle(&weightTensor, kernelData.data());
-    AllocateAndCopyDataToITensorHandle(&biasTensor, biasData.data());
+//    ScopedTensorHandle weightTensor(kernelInfo);
+//    ScopedTensorHandle biasTensor(biasInfo);
+//
+//    AllocateAndCopyDataToITensorHandle(&weightTensor, kernelData.data());
+//    AllocateAndCopyDataToITensorHandle(&biasTensor, biasData.data());
 
     Convolution2dQueueDescriptor queueDescriptor;
     queueDescriptor.m_Parameters = descriptor;
-    queueDescriptor.m_Weight     = &weightTensor;
-    queueDescriptor.m_Bias       = &biasTensor;
 
     AddInputToWorkload(queueDescriptor, workloadInfo, inputInfo, inputHandle.get());
     AddInputToWorkload(queueDescriptor, workloadInfo, kernelInfo, weightsHandle.get());
@@ -3995,26 +3922,16 @@
 
     DepthwiseConvolution2dQueueDescriptor queueDescriptor;
     WorkloadInfo workloadInfo;
-    ScopedTensorHandle weightTensor(kernelInfo);
-    ScopedTensorHandle biasTensor(biasInfo);
 
     AddInputToWorkload(queueDescriptor, workloadInfo, inputInfo, inputHandle.get());
     AddInputToWorkload(queueDescriptor, workloadInfo, kernelInfo, weightsHandle.get());
     AddOutputToWorkload(queueDescriptor, workloadInfo, outputInfo, outputHandle.get());
     AddInputToWorkload(queueDescriptor, workloadInfo, biasInfo, biasHandle.get());
 
-    // AllocateAndCopyDataToITensorHandle() is required twice for the weights AND biases:
-    // See comment in DepthwiseConvolution2dAsymmetricTestImpl() for reasons.
-    // 1) ScopedTensorHandle (weightsTensor) required for QueueDescriptor (data.m_Weight).
-    // 2) ITensorHandle (converts to Backend TensorHandle) required in RefWorkload for GetTensorInfo() method.
     AllocateAndCopyDataToITensorHandle(weightsHandle.get(), kernelData.data());
-    AllocateAndCopyDataToITensorHandle(&weightTensor, kernelData.data());
     AllocateAndCopyDataToITensorHandle(biasHandle.get(), biasData.data());
-    AllocateAndCopyDataToITensorHandle(&biasTensor, biasData.data());
 
     queueDescriptor.m_Parameters = descriptor;
-    queueDescriptor.m_Weight     = &weightTensor;
-    queueDescriptor.m_Bias       = &biasTensor;
 
     std::unique_ptr<IWorkload> workload = workloadFactory.CreateWorkload(armnn::LayerType::DepthwiseConvolution2d,
                                                                          queueDescriptor,