diff options
Diffstat (limited to 'src/armnn/layers/Convolution2dLayer.cpp')
-rw-r--r-- | src/armnn/layers/Convolution2dLayer.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/armnn/layers/Convolution2dLayer.cpp b/src/armnn/layers/Convolution2dLayer.cpp index cf7cf0f129..d7a7a330ef 100644 --- a/src/armnn/layers/Convolution2dLayer.cpp +++ b/src/armnn/layers/Convolution2dLayer.cpp @@ -145,12 +145,14 @@ Layer::ConstantTensors Convolution2dLayer::GetConstantTensorsByRef() void Convolution2dLayer::Accept(ILayerVisitor& visitor) const { - ConstTensor weightsTensor(m_Weight->GetTensorInfo(), m_Weight->Map(true)) ; - Optional<ConstTensor> optionalBiasTensor = EmptyOptional(); + 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); } @@ -159,11 +161,13 @@ void Convolution2dLayer::Accept(ILayerVisitor& visitor) const void Convolution2dLayer::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())); } strategy.ExecuteStrategy(this, GetParameters(), constTensors, GetName()); |