diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2020-11-27 12:40:52 +0000 |
---|---|---|
committer | TeresaARM <teresa.charlinreyes@arm.com> | 2020-11-30 15:12:22 +0000 |
commit | 34fa1bd7994af9abf52dbcc4aa808d0fa5f14aa3 (patch) | |
tree | 8ff6041b92da57cd56ccbcd3b746bdc0fb29078a /delegate/src/DelegateUtils.hpp | |
parent | b7fa5104715e097bf3778d2485d759a4612460cc (diff) | |
download | armnn-34fa1bd7994af9abf52dbcc4aa808d0fa5f14aa3.tar.gz |
IVGCVSW-5393 'TfLiteDelegate: Implement the split operators'
* Added SPLIT and SPLIT_V support to armnn_delegate
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I2def9b8be783b25ef17a997e521c6027553035d3
Diffstat (limited to 'delegate/src/DelegateUtils.hpp')
-rw-r--r-- | delegate/src/DelegateUtils.hpp | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/delegate/src/DelegateUtils.hpp b/delegate/src/DelegateUtils.hpp index fad07ff267..9f39a30727 100644 --- a/delegate/src/DelegateUtils.hpp +++ b/delegate/src/DelegateUtils.hpp @@ -98,31 +98,54 @@ TfLiteStatus ValidateNumOutputs(TfLiteContext* tfLiteContext, return kTfLiteOk; } +bool IsDynamicTensor(const TfLiteTensor& tfLiteTensor) +{ + auto tensorAllocationType = tfLiteTensor.allocation_type; + if (tensorAllocationType == kTfLiteDynamic) + { + return true; + } + return false; +} + bool IsValid(const TfLiteTensor* tfLiteTensor) { return tfLiteTensor == nullptr ? false : true; } -uint32_t NonNegative(int32_t value, int nodeIndex) +bool IsValid(TfLiteContext* tfLiteContext, const TfLiteTensor& tfLiteTensor, int32_t operatorCode, int32_t nodeIndex) { - if (value < 0) + if(!IsValid(&tfLiteTensor)) { - throw armnn::Exception("TfLiteArmnnDelegate: Non-negative value in node " + nodeIndex); + std::cout << "..Is Not Valid" << std::endl; + TF_LITE_MAYBE_KERNEL_LOG( + tfLiteContext, + "TfLiteArmnnDelegate: Invalid TfLite tensor in operator #%d node #%d: ", + operatorCode, nodeIndex); + return false; } - else + if (IsDynamicTensor(tfLiteTensor)) { - return static_cast<uint32_t>(value); + std::cout << "..IsDynamicTensor" << std::endl; + TF_LITE_MAYBE_KERNEL_LOG( + tfLiteContext, + "TfLiteArmnnDelegate: Dynamic tensors are not supported in operator #%d node #%d: ", + operatorCode, nodeIndex); + return false; } + return true; } -bool IsDynamicTensor(const TfLiteTensor& tfLiteTensor) +uint32_t NonNegative(int32_t value, int nodeIndex) { - auto tensorAllocationType = tfLiteTensor.allocation_type; - if (tensorAllocationType == kTfLiteDynamic) + if (value < 0) { - return true; + throw armnn::Exception("TfLiteArmnnDelegate: Non-negative value in node " + nodeIndex); + } + else + { + return static_cast<uint32_t>(value); } - return false; } bool IsAffineQuantization(const TfLiteTensor& tfLiteTensor) |