IVGCVSW-5558 'Output all zeroes using EthosNAcc backend when falling back to CpuRef'

Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I0c3ece5baf587e6cc22dfbec7ff98bd3573e0243
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp
index b5a1b39..7ef7f5f 100644
--- a/src/armnn/LoadedNetwork.cpp
+++ b/src/armnn/LoadedNetwork.cpp
@@ -673,29 +673,24 @@
     }
     if (needMemCopy)
     {
-        const Layer& connectedLayer = layer.GetInputSlots()[0].GetConnectedOutputSlot()->GetOwningLayer();
-        // Do not add MemCopy Layer if OutputLayer is already connected the MemCopy Layer
-        if (connectedLayer.GetType() != LayerType::MemCopy)
+        // If we got here then we didn't export the memory, so add an output workload which performs a memcopy.
+        outputQueueDescriptor.m_Inputs.push_back(inputTensorHandle);
+        info.m_InputTensorInfos.push_back(inputTensorInfo);
+
+        std::unique_ptr<IWorkload> outputWorkload =
+            std::make_unique<CopyMemGenericWorkload>(outputQueueDescriptor, info);
+        ARMNN_ASSERT_MSG(outputWorkload, "No output workload created");
+
+        std::unique_ptr<TimelineUtilityMethods> timelineUtils =
+            TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+        if (timelineUtils)
         {
-            // If we got here then we didn't export the memory, so add an output workload which performs a memcopy.
-            outputQueueDescriptor.m_Inputs.push_back(inputTensorHandle);
-            info.m_InputTensorInfos.push_back(inputTensorInfo);
-
-            std::unique_ptr<IWorkload> outputWorkload =
-                std::make_unique<CopyMemGenericWorkload>(outputQueueDescriptor, info);
-            ARMNN_ASSERT_MSG(outputWorkload, "No output workload created");
-
-            std::unique_ptr<TimelineUtilityMethods> timelineUtils =
-                TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
-            if (timelineUtils)
-            {
-                // Add Output Workload to the post-optimisation network structure
-                AddWorkloadStructure(timelineUtils, outputWorkload, layer);
-                timelineUtils->Commit();
-            }
-
-            m_OutputQueue.push_back(move(outputWorkload));
+            // Add Output Workload to the post-optimisation network structure
+            AddWorkloadStructure(timelineUtils, outputWorkload, layer);
+            timelineUtils->Commit();
         }
+
+        m_OutputQueue.push_back(move(outputWorkload));
     }
 }