aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfLiteParser/test
diff options
context:
space:
mode:
authorTamas Nyiri <tamas.nyiri@arm.com>2021-11-23 17:37:22 +0000
committerTamas Nyiri <tamas.nyiri@arm.com>2021-11-26 12:07:47 +0000
commit9fc259682c8b85af58bda42e87703bbec5ae57ce (patch)
tree3376bd2ef3a5b7f0792f52de38b4ad8fc9d09af4 /src/armnnTfLiteParser/test
parent6f1c67d6bfcb61fe3bc920180c9fd40a6b40181f (diff)
downloadarmnn-9fc259682c8b85af58bda42e87703bbec5ae57ce.tar.gz
IVGCVSW-6252 Armnn Error: Failed to parse operator #1 within subgraph #0 error: Operator not supported
* Added missing support for reshape operator in tflite parser when the target shape is dynamic and batch size is unknown * Added corresponding unit test Change-Id: I78f4b386f2e5e0d08ecacde17e33e304f6afbb70 Signed-off-by: Tamas Nyiri <tamas.nyiri@arm.com>
Diffstat (limited to 'src/armnnTfLiteParser/test')
-rw-r--r--src/armnnTfLiteParser/test/ReshapeDynamic.cpp172
1 files changed, 172 insertions, 0 deletions
diff --git a/src/armnnTfLiteParser/test/ReshapeDynamic.cpp b/src/armnnTfLiteParser/test/ReshapeDynamic.cpp
new file mode 100644
index 0000000000..ca993fb90c
--- /dev/null
+++ b/src/armnnTfLiteParser/test/ReshapeDynamic.cpp
@@ -0,0 +1,172 @@
+//
+// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "ParserFlatbuffersFixture.hpp"
+
+
+TEST_SUITE("TensorflowLiteParser_Reshape_Dynamic")
+{
+struct ReshapeDynamicFixture : public ParserFlatbuffersFixture
+{
+ explicit ReshapeDynamicFixture()
+ {
+ m_JsonString = R"(
+{
+ "version": 3,
+ "operator_codes": [
+ {
+ "deprecated_builtin_code": 77,
+ "version": 1,
+ "builtin_code": "ADD"
+ },
+ {
+ "deprecated_builtin_code": 22,
+ "version": 1,
+ "builtin_code": "ADD"
+ }
+ ],
+ "subgraphs": [
+ {
+ "tensors": [
+ {
+ "shape": [
+ 1,
+ 9
+ ],
+ "type": "FLOAT32",
+ "buffer": 1,
+ "name": "input_33",
+ "quantization": {
+ "details_type": "NONE",
+ "quantized_dimension": 0
+ },
+ "is_variable": false,
+ "shape_signature": [
+ -1,
+ 9
+ ]
+ },
+ {
+ "shape": [
+ 2
+ ],
+ "type": "INT32",
+ "buffer": 2,
+ "name": "functional_15/tf_op_layer_Shape_9/Shape_9",
+ "quantization": {
+ "details_type": "NONE",
+ "quantized_dimension": 0
+ },
+ "is_variable": false
+ },
+ {
+ "shape": [
+ 1,
+ 9
+ ],
+ "type": "FLOAT32",
+ "buffer": 3,
+ "name": "Identity",
+ "quantization": {
+ "details_type": "NONE",
+ "quantized_dimension": 0
+ },
+ "is_variable": false,
+ "shape_signature": [
+ -1,
+ 9
+ ]
+ }
+ ],
+ "inputs": [
+ 0
+ ],
+ "outputs": [
+ 2
+ ],
+ "operators": [
+ {
+ "opcode_index": 0,
+ "inputs": [
+ 0
+ ],
+ "outputs": [
+ 1
+ ],
+ "builtin_options_type": "ShapeOptions",
+ "builtin_options": {
+ "out_type": "INT32"
+ },
+ "custom_options_format": "FLEXBUFFERS"
+ },
+ {
+ "opcode_index": 1,
+ "inputs": [
+ 0,
+ 1
+ ],
+ "outputs": [
+ 2
+ ],
+ "builtin_options_type": "NONE",
+ "custom_options_format": "FLEXBUFFERS"
+ }
+ ],
+ "name": "main"
+ }
+ ],
+ "description": "MLIR Converted.",
+ "buffers": [
+ {
+ },
+ {
+ },
+ {
+ },
+ {
+ },
+ {
+ "data": [
+ 49,
+ 46,
+ 49,
+ 48,
+ 46,
+ 48,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ]
+ }
+ ],
+ "metadata": [
+ {
+ "name": "min_runtime_version",
+ "buffer": 4
+ }
+ ]
+}
+)";
+
+ }
+};
+
+TEST_CASE_FIXTURE(ReshapeDynamicFixture, "ParseReshapeDynamic")
+{
+ SetupSingleInputSingleOutput("input_33", "Identity");
+ RunTest<2, armnn::DataType::Float32>(0,
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
+ CHECK((m_Parser->GetNetworkOutputBindingInfo(0, "Identity").second.GetShape()
+ == armnn::TensorShape({1,9})));
+}
+} \ No newline at end of file