From d0420cb62b71f9c015d2b0e889011899051e56c0 Mon Sep 17 00:00:00 2001 From: Finn Williams Date: Wed, 18 May 2022 13:24:14 +0100 Subject: Remove use of PostAllocationConfigure from ExecuteAsync calls * Resolves: IVGCVSW-6952 Signed-off-by: Finn Williams Change-Id: Ic85bd5267cf94e0ee8461ff4e62b9db3cb80877a --- .../workloads/RefFullyConnectedWorkload.cpp | 57 ++++++++-------------- 1 file changed, 20 insertions(+), 37 deletions(-) (limited to 'src/backends/reference/workloads/RefFullyConnectedWorkload.cpp') diff --git a/src/backends/reference/workloads/RefFullyConnectedWorkload.cpp b/src/backends/reference/workloads/RefFullyConnectedWorkload.cpp index c6ea147043..087fc9da68 100644 --- a/src/backends/reference/workloads/RefFullyConnectedWorkload.cpp +++ b/src/backends/reference/workloads/RefFullyConnectedWorkload.cpp @@ -12,43 +12,26 @@ namespace armnn { -RefFullyConnectedWorkload::RefFullyConnectedWorkload( - const FullyConnectedQueueDescriptor& descriptor, const WorkloadInfo& info) - : RefBaseWorkload(descriptor, info) -{ -} -void RefFullyConnectedWorkload::PostAllocationConfigure() +unsigned int GetNumActivations(const TensorInfo& inputInfo) { - PostAllocationConfigure(m_Data.m_Inputs, m_Data.m_Outputs); -} - -void RefFullyConnectedWorkload::PostAllocationConfigure(std::vector inputs, - std::vector outputs) -{ - const TensorInfo& inputInfo = GetTensorInfo(inputs[0]); - ARMNN_ASSERT(inputInfo.GetNumDimensions() > 1); - m_InputShape = inputInfo.GetShape(); - - const TensorInfo& rWeightInfo = GetTensorInfo(inputs[1]); - ARMNN_ASSERT(inputInfo.GetNumDimensions() > 1); - m_WeightShape = rWeightInfo.GetShape(); - m_WeightDecoder = MakeDecoder(rWeightInfo); - - if (m_Data.m_Parameters.m_BiasEnabled) + unsigned int numActivations = 1; // Total number of activations in the input. + for (unsigned int i = 1; i < inputInfo.GetNumDimensions(); i++) { - const TensorInfo& biasInfo = GetTensorInfo(inputs[2]); - m_BiasDecoder = MakeDecoder(biasInfo); + numActivations *= inputInfo.GetShape()[i]; } + return numActivations; +} - const TensorInfo& outputInfo = GetTensorInfo(outputs[0]); - m_OutputShape = outputInfo.GetShape(); - m_NumActivations = 1; // Total number of activations in the input. - for (unsigned int i = 1; i < inputInfo.GetNumDimensions(); i++) - { - m_NumActivations *= inputInfo.GetShape()[i]; - } +RefFullyConnectedWorkload::RefFullyConnectedWorkload( + const FullyConnectedQueueDescriptor& descriptor, const WorkloadInfo& info) + : RefBaseWorkload(descriptor, info) + , m_InputShape(info.m_InputTensorInfos[0].GetShape()) + , m_WeightShape(info.m_InputTensorInfos[1].GetShape()) + , m_OutputShape(info.m_OutputTensorInfos[0].GetShape()) + , m_NumActivations(GetNumActivations(info.m_InputTensorInfos[0])) +{ } void RefFullyConnectedWorkload::Execute() const @@ -58,8 +41,6 @@ void RefFullyConnectedWorkload::Execute() const void RefFullyConnectedWorkload::ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) { - PostAllocationConfigure(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs); - Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs); } @@ -70,10 +51,12 @@ void RefFullyConnectedWorkload::Execute(std::vector inputs, std: std::unique_ptr> inputDecoder = MakeDecoder(GetTensorInfo(inputs[0]), inputs[0]->Map()); std::unique_ptr> OutputEncoder = MakeEncoder(GetTensorInfo(outputs[0]), outputs[0]->Map()); - m_WeightDecoder->Reset(inputs[1]->Map()); + std::unique_ptr> weightsDecoder = MakeDecoder(GetTensorInfo(inputs[1]), inputs[1]->Map()); + std::unique_ptr> biasDecoder; + if (m_Data.m_Parameters.m_BiasEnabled) { - m_BiasDecoder->Reset(inputs[2]->Map()); + biasDecoder = MakeDecoder(GetTensorInfo(inputs[2]), inputs[2]->Map()); } FullyConnected(m_InputShape, @@ -81,8 +64,8 @@ void RefFullyConnectedWorkload::Execute(std::vector inputs, std: m_OutputShape, *OutputEncoder, m_WeightShape, - *m_WeightDecoder, - m_BiasDecoder.get(), + *weightsDecoder, + biasDecoder.get(), m_Data.m_Parameters.m_BiasEnabled, m_NumActivations, m_Data.m_Parameters.m_TransposeWeightMatrix); -- cgit v1.2.1