ArmNN
 22.05.01
Shape.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 TEST_SUITE("TensorflowLiteParser_Shape")
9 {
10 struct ShapeFixture : public ParserFlatbuffersFixture
11 {
12  explicit ShapeFixture(const std::string& inputShape,
13  const std::string& outputShape,
14  const std::string& inputDataType,
15  const std::string& outputDataType)
16  {
17  m_JsonString = R"(
18  {
19  "version": 3,
20  "operator_codes": [ { "builtin_code": "SHAPE" } ],
21  "subgraphs": [ {
22  "tensors": [
23  {
24  "shape": )" + inputShape + R"(,
25  "type": )" + inputDataType + R"(,
26  "buffer": 0,
27  "name": "inputTensor",
28  "quantization": {
29  "min": [ 0.0 ],
30  "max": [ 255.0 ],
31  "scale": [ 1.0 ],
32  "zero_point": [ 0 ],
33  }
34  },
35  {
36  "shape": )" + outputShape + R"(,
37  "type": )" + outputDataType + R"(,
38  "buffer": 1,
39  "name": "outputTensor",
40  "quantization": {
41  "min": [ 0.0 ],
42  "max": [ 255.0 ],
43  "scale": [ 1.0 ],
44  "zero_point": [ 0 ],
45  }
46  }
47  ],
48  "inputs": [ 0 ],
49  "outputs": [ 1 ],
50  "operators": [
51  {
52  "opcode_index": 0,
53  "inputs": [ 0 ],
54  "outputs": [ 1 ],
55  "custom_options_format": "FLEXBUFFERS"
56  }
57  ],
58  } ],
59  "buffers" : [ {}, {} ]
60  }
61  )";
62  SetupSingleInputSingleOutput("inputTensor", "outputTensor");
63  }
64 };
65 
66 
67 struct SimpleShapeFixture : ShapeFixture
68 {
69  SimpleShapeFixture() : ShapeFixture("[ 1, 3, 3, 1 ]",
70  "[ 4 ]",
71  "INT32",
72  "INT32") {}
73 };
74 
75 TEST_CASE_FIXTURE(SimpleShapeFixture, "SimpleShapeFixture")
76 {
77  RunTest<1, armnn::DataType::Signed32>(
78  0,
79  {{"inputTensor", { 1, 1, 1, 1, 1, 1, 1, 1, 1 }}},
80  {{"outputTensor",{ 1, 3, 3, 1 }}});
81 }
82 
83 }
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")
TEST_SUITE("OnnxParser_Shape")
Definition: Shape.cpp:10
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)