diff options
Diffstat (limited to 'delegate/src')
-rw-r--r-- | delegate/src/DelegateUtils.hpp | 12 | ||||
-rw-r--r-- | delegate/src/armnn_delegate.cpp | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/delegate/src/DelegateUtils.hpp b/delegate/src/DelegateUtils.hpp index 940d269c5b..e0de809ab3 100644 --- a/delegate/src/DelegateUtils.hpp +++ b/delegate/src/DelegateUtils.hpp @@ -420,6 +420,7 @@ armnn::TensorInfo GetTensorInfoForTfLiteTensor(const TfLiteTensor& tfLiteTensor) safeShape.data(), dimensionsSpecificity); ret = armnn::TensorInfo(tensorShape, type); + ret.SetConstant(true); } else { @@ -442,7 +443,16 @@ armnn::TensorInfo GetTensorInfoForTfLiteTensor(const TfLiteTensor& tfLiteTensor) armnn::TensorShape tensorShape(static_cast<unsigned int>(tensorDimensionSize), tensorDims.data(), dimensionsSpecificity); - ret = armnn::TensorInfo(tensorShape, type); + + if(tflite::IsConstantTensor(&tfLiteTensor)) + { + ret = armnn::TensorInfo(tensorShape, type); + ret.SetConstant(true); + } + else + { + ret = armnn::TensorInfo(tensorShape, type); + } } auto quantizationInfo = tfLiteTensor.quantization; diff --git a/delegate/src/armnn_delegate.cpp b/delegate/src/armnn_delegate.cpp index 4c1bc57fc2..0069b4fe0e 100644 --- a/delegate/src/armnn_delegate.cpp +++ b/delegate/src/armnn_delegate.cpp @@ -422,7 +422,9 @@ TfLiteStatus ArmnnSubgraph::Invoke(TfLiteContext* tfLiteContext, TfLiteNode* tfL if (tensor->allocation_type != kTfLiteMmapRo) { const armnn::BindingPointInfo& inputBinding = m_InputBindings[inputIndex]; - const armnn::ConstTensor inputTensor(inputBinding.second, tensor->data.data); + armnn::TensorInfo inputTensorInfo = inputBinding.second; + inputTensorInfo.SetConstant(true); + const armnn::ConstTensor inputTensor(inputTensorInfo, tensor->data.data); inputTensors.emplace_back(inputIdx, inputTensor); ++inputIndex; |