ArmNN
 22.05
DepthToSpace.cpp File Reference

Go to the source code of this file.

Functions

 TEST_SUITE ("TensorflowLiteParser_DepthToSpace")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "TensorflowLiteParser_DepthToSpace"  )

Definition at line 9 of file DepthToSpace.cpp.

References ParserFlatbuffersFixture::SetupSingleInputSingleOutput(), and TEST_CASE_FIXTURE().

10 {
11 struct DepthToSpaceFixture : public ParserFlatbuffersFixture
12 {
13  explicit DepthToSpaceFixture(const std::string& inputShape,
14  const std::string& outputShape,
15  const std::string& dataType = "FLOAT32",
16  const std::string& scale = "1.0",
17  const std::string& offset = "0")
18  {
19  m_JsonString = R"(
20  {
21  "version": 3,
22  "operator_codes": [ { "builtin_code": "DEPTH_TO_SPACE" } ],
23  "subgraphs": [ {
24  "tensors": [
25  {
26  "shape": )" + inputShape + R"(,
27  "type": )" + dataType + R"(,
28  "buffer": 0,
29  "name": "inputTensor",
30  "quantization": {
31  "min": [ 0.0 ],
32  "max": [ 255.0 ],
33  "scale": [ )" + scale + R"( ],
34  "zero_point": [ )" + offset + R"( ],
35  }
36  },
37  {
38  "shape": )" + outputShape + R"(,
39  "type": )" + dataType + R"(,
40  "buffer": 1,
41  "name": "outputTensor",
42  "quantization": {
43  "min": [ 0.0 ],
44  "max": [ 255.0 ],
45  "scale": [ )" + scale + R"( ],
46  "zero_point": [ )" + offset + R"( ],
47  }
48  }
49  ],
50  "inputs": [ 0 ],
51  "outputs": [ 1 ],
52  "operators": [
53  {
54  "opcode_index": 0,
55  "inputs": [ 0 ],
56  "outputs": [ 1 ],
57  "builtin_options_type": "DepthToSpaceOptions",
58  "builtin_options": {
59  "block_size": 2
60  },
61  "custom_options_format": "FLEXBUFFERS"
62  }
63  ],
64  } ],
65  "buffers" : [
66  { },
67  { },
68  ]
69  }
70  )";
71  SetupSingleInputSingleOutput("inputTensor", "outputTensor");
72  }
73 };
74 
75 struct SimpleDepthToSpaceFixture : public DepthToSpaceFixture
76 {
77  SimpleDepthToSpaceFixture() : DepthToSpaceFixture("[ 1, 2, 2, 4 ]", "[ 1, 4, 4, 1 ]") {}
78 };
79 
80 TEST_CASE_FIXTURE(SimpleDepthToSpaceFixture, "ParseDepthToSpace")
81 {
82  RunTest<4, armnn::DataType::Float32>
83  (0,
84  {{ "inputTensor", { 1.f, 2.f, 3.f, 4.f,
85  5.f, 6.f, 7.f, 8.f,
86  9.f, 10.f, 11.f, 12.f,
87  13.f, 14.f, 15.f, 16.f }}},
88  {{ "outputTensor", { 1.f, 2.f, 5.f, 6.f,
89  3.f, 4.f, 7.f, 8.f,
90  9.f, 10.f, 13.f, 14.f,
91  11.f, 12.f, 15.f, 16.f }}});
92 }
93 
94 }
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)