From 4af561666b0ce5c12164447a5f7eb9722abb85f8 Mon Sep 17 00:00:00 2001 From: Francis Murtagh Date: Tue, 20 Apr 2021 16:37:55 +0100 Subject: IVGCVSW-5816 Constant memory access * Add new class ManagedConstTensorHandle to Unmap when out of scope * Integrate into existing layers that have constants * Add unit tests Signed-off-by: Francis Murtagh Change-Id: I0a05e14e438804b37e9862e76b5ca329483f6b45 --- src/armnn/layers/DetectionPostProcessLayer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/armnn/layers/DetectionPostProcessLayer.cpp') diff --git a/src/armnn/layers/DetectionPostProcessLayer.cpp b/src/armnn/layers/DetectionPostProcessLayer.cpp index e5bbeca424..b5086172dd 100644 --- a/src/armnn/layers/DetectionPostProcessLayer.cpp +++ b/src/armnn/layers/DetectionPostProcessLayer.cpp @@ -80,14 +80,16 @@ Layer::ConstantTensors DetectionPostProcessLayer::GetConstantTensorsByRef() void DetectionPostProcessLayer::Accept(ILayerVisitor& visitor) const { - ConstTensor anchorTensor(m_Anchors->GetTensorInfo(), m_Anchors->GetConstTensor()); + ManagedConstTensorHandle managedAnchors(m_Anchors); + ConstTensor anchorTensor(managedAnchors.GetTensorInfo(), managedAnchors.Map()); visitor.VisitDetectionPostProcessLayer(this, GetParameters(), anchorTensor, GetName()); + m_Anchors->Unmap(); } void DetectionPostProcessLayer::ExecuteStrategy(IStrategy& strategy) const { - std::vector constTensors { {m_Anchors->GetTensorInfo(), m_Anchors->GetConstTensor()} }; - + ManagedConstTensorHandle managedAnchors(m_Anchors); + std::vector constTensors { {managedAnchors.GetTensorInfo(), managedAnchors.Map()} }; strategy.ExecuteStrategy(this, GetParameters(), constTensors, GetName()); } -- cgit v1.2.1