ArmNN
 21.02
ResizeBilinear.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <boost/test/unit_test.hpp>
9 
10 BOOST_AUTO_TEST_SUITE(TensorflowParser)
11 
12 struct ResizeBilinearFixture : public armnnUtils::ParserPrototxtFixture<armnnTfParser::ITfParser>
13 {
14  ResizeBilinearFixture()
15  {
16  m_Prototext = R"(
17 node {
18  name: "graphInput"
19  op: "Placeholder"
20  attr {
21  key: "dtype"
22  value {
23  type: DT_FLOAT
24  }
25  }
26  attr {
27  key: "value"
28  value {
29  tensor {
30  dtype: DT_FLOAT
31  tensor_shape {
32  dim {
33  size: 1
34  }
35  dim {
36  size: 3
37  }
38  dim {
39  size: 3
40  }
41  dim {
42  size: 1
43  }
44  }
45  tensor_content:
46 "\000\000\000\000\000\000\200?\000\000\000@\000\000@@\000\000\200@\000\000\240@\000\000\300@\000\000\340@\000\000\000A"
47  }
48  }
49  }
50 }
51 node {
52  name: "resizeBilinearLayer/size"
53  op: "Const"
54  attr {
55  key: "dtype"
56  value {
57  type: DT_INT32
58  }
59  }
60  attr {
61  key: "value"
62  value {
63  tensor {
64  dtype: DT_INT32
65  tensor_shape {
66  dim {
67  size: 2
68  }
69  }
70  tensor_content: "\005\000\000\000\005\000\000\000"
71  }
72  }
73  }
74 }
75 node {
76  name: "resizeBilinearLayer"
77  op: "ResizeBilinear"
78  input: "graphInput"
79  input: "resizeBilinearLayer/size"
80  attr {
81  key: "T"
82  value {
83  type: DT_FLOAT
84  }
85  }
86  attr {
87  key: "align_corners"
88  value {
89  b: false
90  }
91  }
92 }
93  )";
94 
95  SetupSingleInputSingleOutput({ 1, 3, 3, 1 }, "graphInput", "resizeBilinearLayer");
96  }
97 };
98 
99 BOOST_FIXTURE_TEST_CASE(ParseResizeBilinear, ResizeBilinearFixture)
100 {
101  RunTest<4>(// Input data.
102  { 0.0f, 1.0f, 2.0f,
103  3.0f, 4.0f, 5.0f,
104  6.0f, 7.0f, 8.0f },
105  // Expected output data.
106  { 0.0f, 0.6f, 1.2f, 1.8f, 2.0f,
107  1.8f, 2.4f, 3.0f, 3.6f, 3.8f,
108  3.6f, 4.2f, 4.8f, 5.4f, 5.6f,
109  5.4f, 6.0f, 6.6f, 7.2f, 7.4f,
110  6.0f, 6.6f, 7.2f, 7.8f, 8.0f });
111 
112 }
113 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_SUITE_END()
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
Parses and loads the network defined by the m_Prototext string.
BOOST_FIXTURE_TEST_CASE(ParseResizeBilinear, SimpleResizeBilinearFixture)