blob: da2be7b2382cd646befe8da3efd54eba7db332a0 [file] [log] [blame]
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +00006#include "ParserFlatbuffersSerializeFixture.hpp"
Finn Williams85d36712021-01-26 22:30:06 +00007#include <armnnDeserializer/IDeserializer.hpp>
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +00008
9#include <string>
10
Sadik Armagan1625efc2021-06-10 18:24:34 +010011TEST_SUITE("Deserializer_ResizeBilinear")
12{
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +000013struct ResizeBilinearFixture : public ParserFlatbuffersSerializeFixture
14{
15 explicit ResizeBilinearFixture(const std::string& inputShape,
16 const std::string& targetWidth,
17 const std::string& targetHeight,
18 const std::string& dataLayout,
19 const std::string& outputShape,
20 const std::string& dataType)
21 {
22 m_JsonString = R"(
23 {
24 inputIds: [0],
25 outputIds: [2],
26 layers: [
27 {
28 layer_type: "InputLayer",
29 layer: {
30 base: {
31 layerBindingId: 0,
32 base: {
33 index: 0,
34 layerName: "InputLayer",
35 layerType: "Input",
36 inputSlots: [{
37 index: 0,
38 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
39 }],
40 outputSlots: [{
41 index: 0,
42 tensorInfo: {
43 dimensions: )" + inputShape + R"(,
44 dataType: )" + dataType + R"(
45 }
46 }]
47 }
48 }
49 }
50 },
51 {
52 layer_type: "ResizeBilinearLayer",
53 layer: {
54 base: {
55 index: 1,
56 layerName: "ResizeBilinearLayer",
57 layerType: "ResizeBilinear",
58 inputSlots: [{
59 index: 0,
60 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
61 }],
62 outputSlots: [{
63 index: 0,
64 tensorInfo: {
65 dimensions: )" + outputShape + R"(,
66 dataType: )" + dataType + R"(
67 }
68 }]
69 },
70 descriptor: {
71 targetWidth: )" + targetWidth + R"(,
72 targetHeight: )" + targetHeight + R"(,
73 dataLayout: )" + dataLayout + R"(,
74 }
75 }
76 },
77 {
78 layer_type: "OutputLayer",
79 layer: {
80 base:{
81 layerBindingId: 2,
82 base: {
83 index: 2,
84 layerName: "OutputLayer",
85 layerType: "Output",
86 inputSlots: [{
87 index: 0,
88 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
89 }],
90 outputSlots: [{
91 index: 0,
92 tensorInfo: {
93 dimensions: )" + outputShape + R"(,
94 dataType: )" + dataType + R"(
95 },
96 }],
97 }
98 }
99 },
100 }
101 ]
102 }
103 )";
104 SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
105 }
106};
107
108struct SimpleResizeBilinearFixture : ResizeBilinearFixture
109{
110 SimpleResizeBilinearFixture() : ResizeBilinearFixture("[1, 2, 2, 2]",
111 "1",
112 "1",
113 "NCHW",
114 "[1, 2, 1, 1]",
115 "Float32") {}
116};
117
Sadik Armagan1625efc2021-06-10 18:24:34 +0100118TEST_CASE_FIXTURE(SimpleResizeBilinearFixture, "SimpleResizeBilinearFloat32")
Nattapat Chaimanowong6522cdc2019-03-01 16:14:13 +0000119{
120 RunTest<4, armnn::DataType::Float32>(0,
121 {
122 1.0f, 255.0f, 200.0f, 250.0f,
123 250.0f, 200.0f, 250.0f, 1.0f
124 },
125 {
126 1.0f, 250.0f
127 });
128}
129
Sadik Armagan1625efc2021-06-10 18:24:34 +0100130}