blob: d9741ee78450479da8456206228531a1c10f91b1 [file] [log] [blame]
surmeh01bceff2f2018-03-29 16:29:27 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
surmeh01bceff2f2018-03-29 16:29:27 +01004//
5
6#include <boost/test/unit_test.hpp>
7#include "armnnTfParser/ITfParser.hpp"
8#include "ParserPrototxtFixture.hpp"
9
10BOOST_AUTO_TEST_SUITE(TensorflowParser)
11
telsoa01c577f2c2018-08-31 09:22:23 +010012struct ResizeBilinearFixture : public armnnUtils::ParserPrototxtFixture<armnnTfParser::ITfParser>
surmeh01bceff2f2018-03-29 16:29:27 +010013{
14 ResizeBilinearFixture()
15 {
16 m_Prototext = R"(
17node {
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}
51node {
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}
75node {
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
99BOOST_FIXTURE_TEST_CASE(ParseResizeBilinear, ResizeBilinearFixture)
100{
telsoa01c577f2c2018-08-31 09:22:23 +0100101 RunTest<4>(// Input data.
surmeh01bceff2f2018-03-29 16:29:27 +0100102 { 0.0f, 1.0f, 2.0f,
103 3.0f, 4.0f, 5.0f,
104 6.0f, 7.0f, 8.0f },
telsoa01c577f2c2018-08-31 09:22:23 +0100105 // Expected output data.
surmeh01bceff2f2018-03-29 16:29:27 +0100106 { 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
114BOOST_AUTO_TEST_SUITE_END()