aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/Redefine.hpp
diff options
context:
space:
mode:
authorFinn Williams <Finn.Williams@arm.com>2021-02-22 15:13:12 +0000
committerJim Flynn <jim.flynn@arm.com>2021-03-03 17:06:43 +0000
commitf806c4d075814a9dc9d206a4db123d3060ad7ebd (patch)
treea110c106598a6830d0862526742314f5048b8acb /delegate/src/Redefine.hpp
parent82c59d75ef0f191887fae1cc2864bbf4b37ac0c5 (diff)
downloadarmnn-experimental/abi-tests.tar.gz
IVGCVSW-5612 Fix tiny_wav2letter_relu_fixed_int8 delegate outputexperimental/abi-tests
* fix delegate perchannel quantization * change delegate to check reshape options before inputs * Add int8 "qsymms8" option to ExecuteNetwork * Add option to run ExecuteNetwork on tflite w/o delegate !referencetests:301301 Signed-off-by: Finn Williams <Finn.Williams@arm.com> Change-Id: If3e12599b17aff1199d7ab0a55e1c901e480083d
Diffstat (limited to 'delegate/src/Redefine.hpp')
-rw-r--r--delegate/src/Redefine.hpp43
1 files changed, 17 insertions, 26 deletions
diff --git a/delegate/src/Redefine.hpp b/delegate/src/Redefine.hpp
index 5e130b27f2..3df26cacc3 100644
--- a/delegate/src/Redefine.hpp
+++ b/delegate/src/Redefine.hpp
@@ -83,10 +83,19 @@ TfLiteStatus VisitReshapeOperator(DelegateData& delegateData,
armnn::ReshapeDescriptor reshapeDesc;
std::vector<int32_t> targetShape;
- bool shapeSet = false;
+
+ TfLiteReshapeParams* reshapeOptions = reinterpret_cast<TfLiteReshapeParams*>(tfLiteNode->builtin_data);
// The new shape can be defined by either a second input tensor or by a builtin option, we need to check for both.
- if (numInputs == 2)
+ // Options might be set without valid data. we need to check the dimensions are in a valid range.
+ if (reshapeOptions && reshapeOptions->num_dimensions > 0 && reshapeOptions->num_dimensions <= 8)
+ {
+ for (int i=0; i < reshapeOptions->num_dimensions; ++i)
+ {
+ targetShape.push_back(reshapeOptions->shape[i]);
+ }
+ }
+ else if (numInputs == 2)
{
// Get shape from the second input tensor
const TfLiteTensor& tfLiteShapeInputTensor = tfLiteTensors[tfLiteNode->inputs->data[1]];
@@ -111,33 +120,15 @@ TfLiteStatus VisitReshapeOperator(DelegateData& delegateData,
{
targetShape.push_back(*(shapeTensorDataPtr+i));
}
- shapeSet = true;
}
}
- if (!shapeSet)
+ else
{
- // Get shape from the builtin data
- TfLiteReshapeParams* reshapeOptions = reinterpret_cast<TfLiteReshapeParams*>(tfLiteNode->builtin_data);
-
- if (reshapeOptions != nullptr)
- {
- // Options might be set without valid data. we need to check the dimensions are in a valid range.
- if (reshapeOptions->num_dimensions > 0 && reshapeOptions->num_dimensions <= 8)
- {
- for (int i=0; i < reshapeOptions->num_dimensions; ++i)
- {
- targetShape.push_back(reshapeOptions->shape[i]);
- }
- }
- }
- else
- {
- TF_LITE_MAYBE_KERNEL_LOG(tfLiteContext,
- "Target shape not defined in reshape parameters or input tensor. "
- "At least one method required in operator #%d node #%d: ",
- operatorCode, nodeIndex);
- return kTfLiteError;
- }
+ TF_LITE_MAYBE_KERNEL_LOG(tfLiteContext,
+ "Target shape not defined in reshape parameters or input tensor. "
+ "At least one method required in operator #%d node #%d: ",
+ operatorCode, nodeIndex);
+ return kTfLiteError;
}
// Use the data to create the required tensor shape.