aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/DelegateUtils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'delegate/src/DelegateUtils.hpp')
-rw-r--r--delegate/src/DelegateUtils.hpp43
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)