21.02
DeserializeConvolution2d.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>
7
#include "
ParserFlatbuffersSerializeFixture.hpp
"
8
#include <
armnnDeserializer/IDeserializer.hpp
>
9
10
#include <string>
11
12
BOOST_AUTO_TEST_SUITE
(Deserializer)
13
14
struct
Convolution2dFixture :
public
ParserFlatbuffersSerializeFixture
15
{
16
explicit
Convolution2dFixture(
const
std::string & inputShape1,
17
const
std::string & outputShape,
18
const
std::string & weightsShape,
19
const
std::string & dataType)
20
{
21
m_JsonString
= R
"(
22
{
23
inputIds: [0],
24
outputIds: [2],
25
layers: [{
26
layer_type: "InputLayer",
27
layer: {
28
base: {
29
layerBindingId: 0,
30
base: {
31
index: 0,
32
layerName: "InputLayer",
33
layerType: "Input",
34
inputSlots: [{
35
index: 0,
36
connection: {sourceLayerIndex:0, outputSlotIndex:0 },
37
}],
38
outputSlots: [{
39
index: 0,
40
tensorInfo: {
41
dimensions: )" + inputShape1 + R
"(,
42
dataType: )" + dataType + R
"(,
43
quantizationScale: 0.5,
44
quantizationOffset: 0
45
},
46
}]
47
},
48
}
49
},
50
},
51
{
52
layer_type: "Convolution2dLayer",
53
layer : {
54
base: {
55
index:1,
56
layerName: "Convolution2dLayer",
57
layerType: "Convolution2d",
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
padLeft: 1,
72
padRight: 1,
73
padTop: 1,
74
padBottom: 1,
75
strideX: 2,
76
strideY: 2,
77
biasEnabled: false,
78
dataLayout: NHWC
79
},
80
weights: {
81
info: {
82
dimensions: )" + weightsShape + R
"(,
83
dataType: )" + dataType + R
"(
84
},
85
data_type: IntData,
86
data: {
87
data: [
88
1082130432, 1084227584, 1086324736,
89
0 ,0 ,0 ,
90
1077936128, 1073741824, 1065353216
91
],
92
}
93
}
94
},
95
},
96
{
97
layer_type: "OutputLayer",
98
layer: {
99
base:{
100
layerBindingId: 0,
101
base: {
102
index: 2,
103
layerName: "OutputLayer",
104
layerType: "Output",
105
inputSlots: [{
106
index: 0,
107
connection: {sourceLayerIndex:1, outputSlotIndex:0 },
108
}],
109
outputSlots: [ {
110
index: 0,
111
tensorInfo: {
112
dimensions: )" + outputShape + R
"(,
113
dataType: )" + dataType + R
"(
114
},
115
}],
116
}
117
}},
118
}]
119
}
120
)";
121
Setup
();
122
}
123
};
124
125
struct
SimpleConvolution2dFixture : Convolution2dFixture
126
{
127
SimpleConvolution2dFixture() : Convolution2dFixture(
"[ 1, 5, 5, 1 ]"
,
128
"[ 1, 3, 3, 1 ]"
,
129
"[ 1, 3, 3, 1 ]"
,
130
"Float32"
) {}
131
};
132
133
BOOST_FIXTURE_TEST_CASE
(Convolution2dFloat32, SimpleConvolution2dFixture)
134
{
135
RunTest<4, armnn::DataType::Float32>(
136
0,
137
{{
"InputLayer"
, {1, 5, 2, 3, 5, 8, 7, 3, 6, 3, 3, 3, 9, 1, 9, 4, 1, 8, 1, 3, 6, 8, 1, 9, 2}}},
138
{{
"OutputLayer"
, {23, 33, 24, 91, 99, 48, 26, 50, 19}}});
139
}
140
141
BOOST_AUTO_TEST_SUITE_END
()
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
ParserFlatbuffersSerializeFixture::Setup
void Setup()
Definition:
ParserFlatbuffersSerializeFixture.hpp:47
ParserFlatbuffersSerializeFixture
Definition:
ParserFlatbuffersSerializeFixture.hpp:27
BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(Convolution2dFloat32, SimpleConvolution2dFixture)
Definition:
DeserializeConvolution2d.cpp:133
ParserFlatbuffersSerializeFixture.hpp
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
IDeserializer.hpp
ParserFlatbuffersSerializeFixture::m_JsonString
std::string m_JsonString
Definition:
ParserFlatbuffersSerializeFixture.hpp:37
src
armnnDeserializer
test
DeserializeConvolution2d.cpp
Generated on Fri Mar 19 2021 15:25:37 for ArmNN by
1.8.13