diff options
Diffstat (limited to 'src/armnn/layers/DepthwiseConvolution2dLayer.cpp')
-rw-r--r-- | src/armnn/layers/DepthwiseConvolution2dLayer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp index 0b2114a196..3511ab58d0 100644 --- a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp +++ b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp @@ -153,12 +153,14 @@ Layer::ConstantTensors DepthwiseConvolution2dLayer::GetConstantTensorsByRef() void DepthwiseConvolution2dLayer::Accept(ILayerVisitor& visitor) const { - ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->Map(true)); + ManagedConstTensorHandle managedWeight(m_Weight); + ConstTensor weightsTensor(managedWeight.GetTensorInfo(), managedWeight.Map()); Optional<ConstTensor> optionalBiasTensor = EmptyOptional(); + ManagedConstTensorHandle managedBias(m_Bias); if (GetParameters().m_BiasEnabled) { - ConstTensor biasTensor(m_Bias->GetTensorInfo(), m_Bias->Map(true)); + ConstTensor biasTensor(managedBias.GetTensorInfo(), managedBias.Map()); optionalBiasTensor = Optional<ConstTensor>(biasTensor); } @@ -167,11 +169,13 @@ void DepthwiseConvolution2dLayer::Accept(ILayerVisitor& visitor) const void DepthwiseConvolution2dLayer::ExecuteStrategy(IStrategy& strategy) const { - std::vector<armnn::ConstTensor> constTensors { {m_Weight->GetTensorInfo(), m_Weight->Map(true)} }; + ManagedConstTensorHandle managedWeight(m_Weight); + std::vector<armnn::ConstTensor> constTensors { { managedWeight.GetTensorInfo(), managedWeight.Map() } }; + ManagedConstTensorHandle managedBias(m_Bias); if (GetParameters().m_BiasEnabled) { - constTensors.emplace_back(ConstTensor(m_Bias->GetTensorInfo(), m_Bias->Map(true))); + constTensors.emplace_back(ConstTensor(managedBias.GetTensorInfo(), managedBias.Map(true))); } strategy.ExecuteStrategy(this, GetParameters(), constTensors, GetName()); |