blob: d4716e665f9587dfcf98970c23716d1788f619b9 [file] [log] [blame]
Narumol Prangnawarat7684b182021-08-12 14:48:15 +01001//
Teresa Charlinad1b3d72023-03-14 12:10:28 +00002// Copyright © 2021, 2023 Arm Ltd and Contributors. All rights reserved.
Narumol Prangnawarat7684b182021-08-12 14:48:15 +01003// SPDX-License-Identifier: MIT
4//
5
6#include "UnidirectionalSequenceLstmTestHelper.hpp"
7
8#include <armnn_delegate.hpp>
9
10#include <flatbuffers/flatbuffers.h>
Narumol Prangnawarat7684b182021-08-12 14:48:15 +010011#include <doctest/doctest.h>
12
13namespace armnnDelegate
14{
15
16void UnidirectionalSequenceLstmTest(std::vector<armnn::BackendId>& backends)
17{
18 int32_t batchSize = 3;
19 int32_t timeSize = 2;
20 int32_t inputSize = 3;
21 int32_t outputSize = 4;
22 // cellSize and outputSize have the same size when there is no projection.
23 int32_t numUnits = outputSize;
24
25 //tensorInfo12,
26 bool hasInputToInputWeights = true;
27 std::vector<float> inputToInputWeights = { -0.49536117f, -0.0556083915f, -0.102400711f,
28 -0.117484632f, 0.3298470976f, -0.1179017122f,
29 0.214305695f, 0.42135173085f, 0.003878414626f,
30 -0.348303917f, -0.1881275477f, 0.0343011027f };
31
32 std::vector<float> inputToForgetWeights = { 0.2415594226f, 0.15400093799f, 0.4566498398f,
33 -0.3810434485f, 0.268383264f, -0.009807467424f,
34 -0.3522925403f, -0.24275735512f, -0.28344226125f,
35 0.13512269116f, -0.4932442977f, -0.10039821991f };
36
37 std::vector<float> inputToCellWeights = { -0.2504855627f, 0.184490025045f, -0.2480507493f,
38 0.386399507f, -0.259465157985f, -0.16545993089f,
39 -0.4230232555f, 0.341664791103f, -0.18127849691f,
40 -0.2277662414f, -0.55275535589f, 0.34184026718f };
41
42 std::vector<float> inputToOutputWeights = { 0.2303854227f, 0.5218806862f, -0.4865379333f,
43 0.53969591851f, 0.23393625035f, -0.27140527306f,
44 0.50009280443f, 0.07511717046f, 0.3998299249f,
45 -0.51717478049f, 0.1889653282f, -0.367323637f };
46
47 //tensorInfo16,
48 bool hasRecurrentToInputWeights = true;
49 std::vector<float> recurrentToInputWeights = { -0.128009796112f, 0.1995525098f, -0.07745539397f, 0.1558421701f,
50 -0.265254765766f, -0.38837709614f, -0.05636804124f, 0.4259087456f,
51 0.17628988623f, 0.3877420127f, 0.53300309181f, -0.0959980934f,
52 0.00302857416f, 0.3266998827f, -0.142509296562f, -0.04433270756f };
53
54 std::vector<float> recurrentToForgetWeights = { -0.09499983487f, -0.08814888417f, -0.04834804721f, 0.1516668247f,
55 -0.3967529535f, -0.06463699788f, 0.4952811002f, 0.003274492938f,
56 -0.0968840941f, 0.17928104102f, 0.0031281141592f, -0.3387276584f,
57 -0.3587934076f, 0.06705895066f, 0.22463923692f, 0.1961955726f };
58
59 std::vector<float> recurrentToCellWeights = { -0.21938985582f, -0.3023648226f, -0.1170005202f, -0.3509177422f,
60 -0.4286288613f, 0.2726137042f, 0.09216640889f, -0.06551410215f,
61 0.20453298098f, 0.2393476665f, 0.11846517771f, 0.2630801796f,
62 0.3954237699f, -0.19407111404f, 0.30412107706f, -0.27342408554f };
63
64 std::vector<float> recurrentToOutputWeights = { -0.32921677827f, 0.32624614238f, -0.1388191282f, -0.17879831790f,
65 -0.15185534954f, -0.16918526583f, -0.10087361183f, -0.5436913968f,
66 0.016758225858f, 0.30454617738f, -0.41493862867f, -0.005565764375f,
67 -0.12584099173f, -0.12319286912f, 0.2407919466f, -0.08879069983f };
68 // tensorInfo4
69 bool hasCellToInputWeights = false;
70 std::vector<float> cellToInputWeights;
71 bool hasCellToForgetWeights = false;
72 std::vector<float> cellToForgetWeights;
73 bool hasCellToOutputWeights = false;
74 std::vector<float> cellToOutputWeights;
75
76 bool hasInputGateBias = true;
77 std::vector<float> inputGateBias = {0., 0., 0., 0.};
78 std::vector<float> forgetGateBias = {1., 1., 1., 1.};
79 std::vector<float> cellBias = {0., 0., 0., 0.};
80 std::vector<float> outputGateBias = {0., 0., 0., 0.};
81
82 bool hasProjectionWeights = false;
83 std::vector<float> projectionWeights;
84 bool hasProjectionBias = false;
85 std::vector<float> projectionBias;
86
87 bool hasInputLayerNormWeights = false;
88 std::vector<float> inputLayerNormWeights;
89 bool hasForgetLayerNormWeights = false;
90 std::vector<float> forgetLayerNormWeights;
91 bool hasCellLayerNormWeights = false;
92 std::vector<float> cellLayerNormWeights;
93 bool hasOutputLayerNormWeights = false;
94 std::vector<float> outputLayerNormWeights;
95
96 std::vector<float> inputValues = { 1., 2., 3., 4., 5., 4.,
97 3., 2., 1., 2., 3., 4.,
98 5., 4., 3., 2., 1., 2. };
99 std::vector<float> expectedOutputValues = { -0.0714901f, -0.162117f, -0.175168f, -0.0232934f,
100 -0.168107f, -0.414129f, -0.549875f, -0.00803579f,
101 -0.0668735f, 0.204078f, -0.42765f, -0.0312321f,
102 -0.120003f, -0.0941918f, -0.456391f, -0.0287019f,
103 -0.0342921f, 0.20824f, -0.656989f, -0.00415265f,
104 -0.10493f, 0.14211f, -0.583478f, -0.0329754f };
105
106 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
107 float clippingThresCell = 10.f;
108 float clippingThresProj = 0.f;
109 bool isTimeMajor = false;
110
111 UnidirectionalSequenceLstmTestImpl<float>(backends,
112 ::tflite::TensorType_FLOAT32,
113 batchSize,
114 timeSize,
115 inputSize,
116 outputSize,
117 numUnits,
118 hasInputToInputWeights,
119 inputToInputWeights,
120 inputToForgetWeights,
121 inputToCellWeights,
122 inputToOutputWeights,
123 hasRecurrentToInputWeights,
124 recurrentToInputWeights,
125 recurrentToForgetWeights,
126 recurrentToCellWeights,
127 recurrentToOutputWeights,
128 hasCellToInputWeights,
129 cellToInputWeights,
130 hasCellToForgetWeights,
131 cellToForgetWeights,
132 hasCellToOutputWeights,
133 cellToOutputWeights,
134 hasInputGateBias,
135 inputGateBias,
136 forgetGateBias,
137 cellBias,
138 outputGateBias,
139 hasProjectionWeights,
140 projectionWeights,
141 hasProjectionBias,
142 projectionBias,
143 hasInputLayerNormWeights,
144 inputLayerNormWeights,
145 hasForgetLayerNormWeights,
146 forgetLayerNormWeights,
147 hasCellLayerNormWeights,
148 cellLayerNormWeights,
149 hasOutputLayerNormWeights,
150 outputLayerNormWeights,
151 inputValues,
152 expectedOutputValues,
153 activationFunction,
154 clippingThresCell,
155 clippingThresProj,
156 isTimeMajor);
157}
158
Narumol Prangnawarat5f941242023-08-11 16:09:26 +0100159void UnidirectionalSequenceLstmTimeMajorTestImpl(std::vector<armnn::BackendId>& backends,
160 int32_t timeSize,
161 std::vector<float>& inputValues,
162 std::vector<float>& expectedOutputValues)
Narumol Prangnawarat7684b182021-08-12 14:48:15 +0100163{
164 int32_t batchSize = 3;
Narumol Prangnawarat7684b182021-08-12 14:48:15 +0100165 int32_t inputSize = 3;
166 int32_t outputSize = 4;
167 // cellSize and outputSize have the same size when there is no projection.
168 int32_t numUnits = outputSize;
169
170 std::vector<int32_t> inputShape = {timeSize, batchSize, inputSize};
171 std::vector<int32_t> cellStateInTensorInfo = {batchSize, numUnits};
172 std::vector<int32_t> outputStateInTensorInfo = {batchSize, outputSize};
173
174 std::vector<int32_t> outputTensorInfo = {timeSize, batchSize, outputSize};
175
176 //tensorInfo12
177 bool hasInputToInputWeights = true;
178 std::vector<float> inputToInputWeights = { 0.27277296781539917f, 0.3813590407371521f, -0.394489049911499f,
179 0.2782636880874634f, -0.3793870210647583f, -0.018918335437774658f,
180 0.2724653482437134f, -0.19314253330230713f, -0.2947450876235962f,
181 -0.30253493785858154f, 0.4241350293159485f, -0.22560018301010132f };
182
183 std::vector<float> inputToForgetWeights = { -0.2667974531650543f, -0.05505800247192383f, -0.20932340621948242f,
184 -0.14345619082450867f, 0.09666192531585693f, -0.2604355812072754f,
185 -0.2681812047958374f, -0.3314584493637085f, 0.4485899806022644f,
186 -0.23467743396759033f, 0.5072842240333557f, -0.4192768931388855f };
187
188 std::vector<float> inputToCellWeights = { -0.15782442688941956f, -0.027530014514923096f, 0.4789854884147644f,
189 0.23227906227111816f, 0.28259342908859253f, -0.030095696449279785f,
190 0.10071521997451782f, -0.08535495400428772f, 0.18563997745513916f,
191 -0.3049069046974182f, -0.478048175573349f, 0.025234103202819824f };
192
193 std::vector<float> inputToOutputWeights = { -0.04584759473800659f, -0.2716066539287567f, 0.012970447540283203f,
194 -0.4729190170764923f, -0.37422770261764526f, 0.49352723360061646f,
195 0.3163864016532898f, -0.436781644821167f, -0.33074596524238586f,
196 -0.32885751128196716f, -0.40959352254867554f, -0.2124689817428589f };
197
198 //tensorInfo16
199 bool hasRecurrentToInputWeights = true;
200 std::vector<float> recurrentToInputWeights = { 0.23788475990f, -0.24948765337f, 0.50044941902f, 0.14431896805f,
201 -0.115940228137f, -0.717082679f, -0.17208620906f, 0.17850610617f,
202 -0.16702319684f, -0.11384502053f, -0.309785276245f, -0.3316611672f,
203 0.52380162477f, -0.06839632987f, -0.391478359627f, -0.10756178963f };
204
205 std::vector<float> recurrentToForgetWeights = { 0.11383482068f, 0.1676601767f, -0.08550968004f, 0.03399394089f,
206 0.08042152225f, -0.2133381964f, 0.05182432704f, 0.38161808255f,
207 -0.5018365979f, -0.08043262364f, 0.07894329014f, -0.07547105155f,
208 0.12047368288f, 0.2986997961f, 0.0485043078f, -0.13372567296f };
209
210 std::vector<float> recurrentToCellWeights = { 0.0433832928545f, 0.07587072294f, -0.120520234107f, 0.604576051f,
211 -0.434353142986f, 0.009314475068f, 0.005085289478f, 0.08488202038f,
212 -0.00025437487886f, 0.15245915082f, -0.1936587542f, 0.004754020f,
213 -0.1582719236f, 0.3307867646f, 0.0236605107784f, 0.307716339826f };
214
215 std::vector<float> recurrentToOutputWeights = { -0.079031050201f, 0.041414566286f, -0.583727357285f, 0.1025384515f,
216 -0.172372072937f, 0.09214124082f, 0.178184121827f, -0.2439443916f,
217 0.104485116899f, 0.2600405514f, 0.064414866268f, 0.24141204357f,
218 0.281875759363f, -0.14234502664f, 0.15126448862f, -0.24421440064f };
219 // tensorInfo4
220 bool hasCellToInputWeights = false;
221 std::vector<float> cellToInputWeights;
222 bool hasCellToForgetWeights = false;
223 std::vector<float> cellToForgetWeights;
224 bool hasCellToOutputWeights = false;
225 std::vector<float> cellToOutputWeights;
226
227 bool hasInputGateBias = true;
228 std::vector<float> inputGateBias = {0., 0., 0., 0.};
229 std::vector<float> forgetGateBias = {1., 1., 1., 1.};
230 std::vector<float> cellBias = {0., 0., 0., 0.};
231 std::vector<float> outputGateBias = {0., 0., 0., 0.};
232
233 bool hasProjectionWeights = false;
234 std::vector<float> projectionWeights;
235 bool hasProjectionBias = false;
236 std::vector<float> projectionBias;
237
238 bool hasInputLayerNormWeights = false;
239 std::vector<float> inputLayerNormWeights;
240 bool hasForgetLayerNormWeights = false;
241 std::vector<float> forgetLayerNormWeights;
242 bool hasCellLayerNormWeights = false;
243 std::vector<float> cellLayerNormWeights;
244 bool hasOutputLayerNormWeights = false;
245 std::vector<float> outputLayerNormWeights;
246
Narumol Prangnawarat7684b182021-08-12 14:48:15 +0100247 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
248 float clippingThresCell = 10.f;
249 float clippingThresProj = 0.f;
250 bool isTimeMajor = true;
251
252 UnidirectionalSequenceLstmTestImpl<float>(backends,
253 ::tflite::TensorType_FLOAT32,
254 batchSize,
255 timeSize,
256 inputSize,
257 outputSize,
258 numUnits,
259 hasInputToInputWeights,
260 inputToInputWeights,
261 inputToForgetWeights,
262 inputToCellWeights,
263 inputToOutputWeights,
264 hasRecurrentToInputWeights,
265 recurrentToInputWeights,
266 recurrentToForgetWeights,
267 recurrentToCellWeights,
268 recurrentToOutputWeights,
269 hasCellToInputWeights,
270 cellToInputWeights,
271 hasCellToForgetWeights,
272 cellToForgetWeights,
273 hasCellToOutputWeights,
274 cellToOutputWeights,
275 hasInputGateBias,
276 inputGateBias,
277 forgetGateBias,
278 cellBias,
279 outputGateBias,
280 hasProjectionWeights,
281 projectionWeights,
282 hasProjectionBias,
283 projectionBias,
284 hasInputLayerNormWeights,
285 inputLayerNormWeights,
286 hasForgetLayerNormWeights,
287 forgetLayerNormWeights,
288 hasCellLayerNormWeights,
289 cellLayerNormWeights,
290 hasOutputLayerNormWeights,
291 outputLayerNormWeights,
292 inputValues,
293 expectedOutputValues,
294 activationFunction,
295 clippingThresCell,
296 clippingThresProj,
Narumol Prangnawarat5f941242023-08-11 16:09:26 +0100297 isTimeMajor);}
298
299void UnidirectionalSequenceLstmTimeMajorTest(std::vector<armnn::BackendId>& backends)
300{
301 int32_t timeSize = 2;
302
303 std::vector<float> inputValues = { 1., 2., 3., 4., 5., 4.,
304 3., 2., 1., 2., 3., 4.,
305 5., 4., 3., 2., 1., 2. };
306
307 std::vector<float> expectedOutputValues = { 0.135658f, 0.124673f, 0.021209f, -0.0530204f,
308 0.106138f, 0.0404792f, 0.0151644f, -0.00675166f,
309 -0.0128514f, 0.0644884f, 0.0709072f, -0.0454045f,
310 0.162886f, 0.166494f, 0.0277046f, -0.0369807f,
311 0.111716f, 0.043119f, 0.0762981f, -0.0122854f,
312 0.104397f, 0.2144f, 0.119192f, -0.0839058f };
313
314 UnidirectionalSequenceLstmTimeMajorTestImpl(backends,
315 timeSize,
316 inputValues,
317 expectedOutputValues);
318}
319
320void UnidirectionalSequenceLstmTimeMajorSingleTimeTest(std::vector<armnn::BackendId>& backends)
321{
322 int32_t timeSize = 1;
323
324 std::vector<float> inputValues = { 1., 2., 3.,
325 4., 5., 6.,
326 7., 8., 9. };
327
328 std::vector<float> expectedOutputValues = { 0.13565768f, 0.12467254f, 0.02120903f, -0.05302038f,
329 0.1053334f, 0.08508634f, 0.00667238f, -0.00356043f,
330 0.05638668f, 0.02924093f, 0.00119751f, -0.00017249f };
331
332 UnidirectionalSequenceLstmTimeMajorTestImpl(backends,
333 timeSize,
334 inputValues,
335 expectedOutputValues);
Narumol Prangnawarat7684b182021-08-12 14:48:15 +0100336}
337
338void UnidirectionalSequenceLstmNoCifgWithPeepholeWithProjectionTest(std::vector<armnn::BackendId>& backends)
339{
340 int32_t batchSize = 2;
341 int32_t timeSize = 3;
342 int32_t inputSize = 4;
343 int32_t outputSize = 5;
344 int32_t numUnits = 6;
345
346 std::vector<int32_t> inputShape = {batchSize, timeSize, inputSize};
347 std::vector<int32_t> cellStateInTensorInfo = {batchSize, numUnits};
348 std::vector<int32_t> outputStateInTensorInfo = {batchSize, outputSize};
349
350 std::vector<int32_t> outputTensorInfo = {batchSize, timeSize, outputSize};
351
352 //tensorInfoInputSize,
353 bool hasInputToInputWeights = true;
354 std::vector<float> inputToInputWeights = { 0.021393683f, 0.06124551f, 0.046905167f, -0.014657677f,
355 -0.03149463f, 0.09171803f, 0.14647801f, 0.10797193f,
356 -0.0057968358f, 0.0019193048f, -0.2726754f, 0.10154029f,
357 -0.018539885f, 0.080349885f, -0.10262385f, -0.022599787f,
358 -0.09121155f, -0.008675967f, -0.045206103f, -0.0821282f,
359 -0.008045952f, 0.015478081f, 0.055217247f, 0.038719587f };
360
361 std::vector<float> inputToForgetWeights = { -0.0018401089f, -0.004852237f, 0.03698424f, 0.014181704f,
362 0.028273236f, -0.016726194f, -0.05249759f, -0.10204261f,
363 0.00861066f, -0.040979505f, -0.009899187f, 0.01923892f,
364 -0.028177269f, -0.08535103f, -0.14585495f, 0.10662567f,
365 -0.01909731f, -0.017883534f, -0.0047269356f, -0.045103323f,
366 0.0030784295f, 0.076784775f, 0.07463696f, 0.094531395f};
367
368 std::vector<float> inputToCellWeights = { -0.04580283f, -0.09549462f, -0.032418985f, -0.06454633f,
369 -0.043528453f, 0.043018587f, -0.049152344f, -0.12418144f,
370 -0.078985475f, -0.07596889f, 0.019484362f, -0.11434962f,
371 -0.0074034138f, -0.06314844f, -0.092981495f, 0.0062155537f,
372 -0.025034338f, -0.0028890965f, 0.048929527f, 0.06235075f,
373 0.10665918f, -0.032036792f, -0.08505916f, -0.10843358f };
374
375 std::vector<float> inputToOutputWeights = { -0.0998932f, -0.07201956f, -0.052803773f, -0.15629593f,
376 -0.15001918f, -0.07650751f, 0.02359855f, -0.075155355f,
377 -0.08037709f, -0.15093534f, 0.029517552f, -0.04751393f,
378 0.010350531f, -0.02664851f, -0.016839722f, -0.023121163f,
379 0.0077019283f, 0.012851257f, -0.05040649f, -0.0129761f,
380 -0.021737747f, -0.038305793f, -0.06870586f, -0.01481247f };
381
382 //tensorInfoOutputSize,
383 bool hasRecurrentToInputWeights = true;
384 std::vector<float> recurrentToInputWeights = { -0.001374326f, -0.078856036f, 0.10672688f, 0.029162422f,
385 -0.11585556f, 0.02557986f, -0.13446963f, -0.035785314f,
386 -0.01244275f, 0.025961924f, -0.02337298f, -0.044228926f,
387 -0.055839065f, -0.046598054f, -0.010546039f, -0.06900766f,
388 0.027239809f, 0.022582639f, -0.013296484f, -0.05459212f,
389 0.08981f, -0.045407712f, 0.08682226f, -0.06867011f,
390 -0.14390695f, -0.02916037f, 0.000996957f, 0.091420636f,
391 0.14283475f, -0.07390571f };
392
393 std::vector<float> recurrentToForgetWeights = { -0.057784554f, -0.026057621f, -0.068447545f, -0.022581743f,
394 0.14811787f, 0.10826372f, 0.09471067f, 0.03987225f,
395 -0.0039523416f, 0.00030638507f, 0.053185795f, 0.10572994f,
396 0.08414449f, -0.022036452f, -0.00066928595f, -0.09203576f,
397 0.032950465f, -0.10985798f, -0.023809856f, 0.0021431844f,
398 -0.02196096f, -0.00326074f, 0.00058621005f, -0.074678116f,
399 -0.06193199f, 0.055729095f, 0.03736828f, 0.020123724f,
400 0.061878487f, -0.04729229f };
401
402 std::vector<float> recurrentToCellWeights = { -0.037322544f, 0.018592842f, 0.0056175636f, -0.06253426f,
403 0.055647098f, -0.05713207f, -0.05626563f, 0.005559383f,
404 0.03375411f, -0.025757805f, -0.088049285f, 0.06017052f,
405 -0.06570978f, 0.007384076f, 0.035123326f, -0.07920549f,
406 0.053676967f, 0.044480428f, -0.07663568f, 0.0071805613f,
407 0.08089997f, 0.05143358f, 0.038261272f, 0.03339287f,
408 -0.027673481f, 0.044746667f, 0.028349208f, 0.020090483f,
409 -0.019443132f, -0.030755889f };
410
411 std::vector<float> recurrentToOutputWeights = { 0.025825322f, -0.05813119f, 0.09495884f,
412 -0.045984812f,-0.01255415f, -0.0026479573f,
413 -0.08196161f, -0.054914974f, -0.0046604523f,
414 -0.029587349f, -0.044576716f, -0.07480124f,
415 -0.082868785f, 0.023254942f, 0.027502948f,
416 -0.0039728214f, -0.08683098f, -0.08116779f,
417 -0.014675607f, -0.037924774f, -0.023314456f,
418 -0.007401714f, -0.09255757f, 0.029460307f,
419 -0.08829125f, -0.005139627f, -0.08989442f,
420 -0.0555066f, 0.13596267f, 0.025062224f };
421 // tensorInfoNumUnits
422 bool hasCellToInputWeights = true;
423 std::vector<float> cellToInputWeights = { 0.040369894f, 0.030746894f, 0.24704495f,
424 0.018586371f, -0.037586458f, -0.15312155f };
425 bool hasCellToForgetWeights = true;
426 std::vector<float> cellToForgetWeights = { -0.01998659f, -0.15568835f, -0.24248174f,
427 -0.012770197f, 0.041331276f, -0.072311886f };
428 bool hasCellToOutputWeights = true;
429 std::vector<float> cellToOutputWeights = { 0.08286371f, -0.08261836f, -0.51210177f,
430 0.002913762f, 0.17764764f, -0.5495371f };
431
432 bool hasInputGateBias = true;
433 std::vector<float> inputGateBias = { 0.02234832f, 0.14757581f, 0.18176508f,
434 0.10380666f, 0.053110216f, -0.06928846f };
435 std::vector<float> forgetGateBias = { 0.035185695f, -0.042891346f, -0.03032477f,
436 0.23027696f, 0.11098921f, 0.08989442f };
437 std::vector<float> cellBias = { -0.024379363f, 0.0055531194f, 0.23377132f,
438 0.033463873f, -0.1483596f, 0.029460307f };
439 std::vector<float> outputGateBias = { 0.046159424f, -0.0012809046f, 0.03563469f,
440 0.12648113f, 0.027195795f, 0.35373217f };
441
442 bool hasProjectionWeights = true;
443 std::vector<float> projectionWeights = { -0.009802181f, 0.09401916f, 0.0717386f, -0.13895074f, 0.09641832f,
444 0.060420845f, 0.08539281f, 0.054285463f, 0.061395317f, 0.034448683f,
445 -0.042991187f, 0.019801661f, -0.16840284f, -0.015726732f, -0.23041931f,
446 -0.024478018f, -0.10959692f, -0.013875541f, 0.18600968f, -0.061274476f,
447 0.0138165f, -0.08160894f, -0.07661644f, 0.032372914f, 0.16169067f,
448 0.22465782f, -0.03993472f, -0.004017731f, 0.08633481f, -0.28869787f };
449
450 bool hasProjectionBias = true;
451 std::vector<float> projectionBias(outputSize, 0.f);
452
453 bool hasInputLayerNormWeights = false;
454 std::vector<float> inputLayerNormWeights;
455 bool hasForgetLayerNormWeights = false;
456 std::vector<float> forgetLayerNormWeights;
457 bool hasCellLayerNormWeights = false;
458 std::vector<float> cellLayerNormWeights;
459 bool hasOutputLayerNormWeights = false;
460 std::vector<float> outputLayerNormWeights;
461
462 std::vector<float> inputValues = { 1., 2., 3., 4., 5., 4.,
463 3., 2., 1., 2., 3., 4.,
464 5., 4., 3., 2., 1., 2.,
465 1., 2., 3., 4., 5., 4.};
466 std::vector<float> expectedOutputValues = { -0.0135612f, -0.0263441f, 0.0314008f, -0.00883455f, 0.00763052f,
467 -0.00126877f, -0.0292959f, 0.0449957f, -0.00976195f, -0.00492338f,
468 -0.0175702f, -0.0431753f, 0.0597117f, -0.0169154f, 0.0142087f,
469 0.00472515f, -0.0196355f, 0.0342524f, -0.00407936f, -0.0253189f,
470 -0.00512944f, -0.0293754f, 0.0512771f, -0.0151874f, -0.0246433f,
471 -0.00744986f, -0.0345103f, 0.0450666f, -0.00944991f, 0.0126895f };
472
473 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
474 float clippingThresCell = 10.f;
475 float clippingThresProj = 0.f;
476 bool isTimeMajor = false;
477
478 UnidirectionalSequenceLstmTestImpl<float>(backends,
479 ::tflite::TensorType_FLOAT32,
480 batchSize,
481 timeSize,
482 inputSize,
483 outputSize,
484 numUnits,
485 hasInputToInputWeights,
486 inputToInputWeights,
487 inputToForgetWeights,
488 inputToCellWeights,
489 inputToOutputWeights,
490 hasRecurrentToInputWeights,
491 recurrentToInputWeights,
492 recurrentToForgetWeights,
493 recurrentToCellWeights,
494 recurrentToOutputWeights,
495 hasCellToInputWeights,
496 cellToInputWeights,
497 hasCellToForgetWeights,
498 cellToForgetWeights,
499 hasCellToOutputWeights,
500 cellToOutputWeights,
501 hasInputGateBias,
502 inputGateBias,
503 forgetGateBias,
504 cellBias,
505 outputGateBias,
506 hasProjectionWeights,
507 projectionWeights,
508 hasProjectionBias,
509 projectionBias,
510 hasInputLayerNormWeights,
511 inputLayerNormWeights,
512 hasForgetLayerNormWeights,
513 forgetLayerNormWeights,
514 hasCellLayerNormWeights,
515 cellLayerNormWeights,
516 hasOutputLayerNormWeights,
517 outputLayerNormWeights,
518 inputValues,
519 expectedOutputValues,
520 activationFunction,
521 clippingThresCell,
522 clippingThresProj,
523 isTimeMajor);
524}
525
526void UnidirectionalSequenceLstmWithCifgWithPeepholeNoProjectionTest(std::vector<armnn::BackendId>& backends)
527{
528 int32_t batchSize = 3;
529 int32_t timeSize = 2;
530 int32_t inputSize = 3;
531 int32_t outputSize = 4;
532 // cellSize and outputSize have the same size when there is no projection.
533 int32_t numUnits = outputSize;
534
535 //tensorInfo12
536 bool hasInputToInputWeights = false;
537 std::vector<float> inputToInputWeights{};
538
539 std::vector<float> inputToForgetWeights = { 0.2415594226f, 0.15400093799f, 0.4566498398f,
540 -0.3810434485f, 0.268383264f, -0.009807467424f,
541 -0.3522925403f, -0.24275735512f, -0.28344226125f,
542 0.13512269116f, -0.4932442977f, -0.10039821991f };
543
544 std::vector<float> inputToCellWeights = { -0.2504855627f, 0.184490025045f, -0.2480507493f,
545 0.386399507f, -0.259465157985f, -0.16545993089f,
546 -0.4230232555f, 0.341664791103f, -0.18127849691f,
547 -0.2277662414f, -0.55275535589f, 0.34184026718f };
548
549 std::vector<float> inputToOutputWeights = { 0.2303854227f, 0.5218806862f, -0.4865379333f,
550 0.53969591851f, 0.23393625035f, -0.27140527306f,
551 0.50009280443f, 0.07511717046f, 0.3998299249f,
552 -0.51717478049f, 0.1889653282f, -0.367323637f };
553
554 //tensorInfo16
555 bool hasRecurrentToInputWeights = false;
556 std::vector<float> recurrentToInputWeights{};
557
558 std::vector<float> recurrentToForgetWeights = { -0.09499983487f, -0.08814888417f, -0.04834804721f, 0.1516668247f,
559 -0.3967529535f, -0.06463699788f, 0.4952811002f, 0.003274492938f,
560 -0.0968840941f, 0.17928104102f, 0.0031281141592f, -0.3387276584f,
561 -0.3587934076f, 0.06705895066f, 0.22463923692f, 0.1961955726f };
562
563 std::vector<float> recurrentToCellWeights = { -0.21938985582f, -0.3023648226f, -0.1170005202f, -0.3509177422f,
564 -0.4286288613f, 0.2726137042f, 0.09216640889f, -0.06551410215f,
565 0.20453298098f, 0.2393476665f, 0.11846517771f, 0.2630801796f,
566 0.3954237699f, -0.19407111404f, 0.30412107706f, -0.27342408554f };
567
568 std::vector<float> recurrentToOutputWeights = { -0.32921677827f, 0.32624614238f, -0.1388191282f, -0.17879831790f,
569 -0.15185534954f, -0.16918526583f, -0.10087361183f, -0.5436913968f,
570 0.016758225858f, 0.30454617738f, -0.41493862867f, -0.005565764375f,
571 -0.12584099173f, -0.12319286912f, 0.2407919466f, -0.08879069983f };
572 // tensorInfo4
573 bool hasCellToInputWeights = false;
574 std::vector<float> cellToInputWeights;
575 bool hasCellToForgetWeights = true;
576 std::vector<float> cellToForgetWeights = {0.47485286f, -0.51955009f, -0.24458408f, 0.31544167f};
577 bool hasCellToOutputWeights = true;
578 std::vector<float> cellToOutputWeights = {-0.17135078f, 0.82760304f, 0.85573703f, -0.77109635f};
579
580 bool hasInputGateBias = false;
581 std::vector<float> inputGateBias;
582 std::vector<float> forgetGateBias = {1., 1., 1., 1.};
583 std::vector<float> cellBias = {0., 0., 0., 0.};
584 std::vector<float> outputGateBias = {0., 0., 0., 0.};
585
586 bool hasProjectionWeights = false;
587 std::vector<float> projectionWeights;
588 bool hasProjectionBias = false;
589 std::vector<float> projectionBias;
590
591 bool hasInputLayerNormWeights = false;
592 std::vector<float> inputLayerNormWeights;
593 bool hasForgetLayerNormWeights = false;
594 std::vector<float> forgetLayerNormWeights;
595 bool hasCellLayerNormWeights = false;
596 std::vector<float> cellLayerNormWeights;
597 bool hasOutputLayerNormWeights = false;
598 std::vector<float> outputLayerNormWeights;
599
600 std::vector<float> inputValues = { 1., 2., 3., 4., 5., 4.,
601 3., 2., 1., 2., 3., 4.,
602 5., 4., 3., 2., 1., 2. };
603 std::vector<float> expectedOutputValues = { -0.0129257f, -0.070531f, -0.153508f, -0.0392391f,
604 -0.0300169f, -0.195717f, -0.528679f, -0.0818106f,
605 -0.0332748f, 0.155429f, -0.353966f, -0.0801505f,
606 -0.032312f, -0.0407911f, -0.435053f, -0.0932317f,
607 -0.0108233f, 0.165584f, -0.640424f, -0.0447535f,
608 -0.031675f, 0.125987f, -0.526695f, -0.110093f };
609
610 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
611 float clippingThresCell = 10.f;
612 float clippingThresProj = 0.f;
613 bool isTimeMajor = false;
614
615 UnidirectionalSequenceLstmTestImpl<float>(backends,
616 ::tflite::TensorType_FLOAT32,
617 batchSize,
618 timeSize,
619 inputSize,
620 outputSize,
621 numUnits,
622 hasInputToInputWeights,
623 inputToInputWeights,
624 inputToForgetWeights,
625 inputToCellWeights,
626 inputToOutputWeights,
627 hasRecurrentToInputWeights,
628 recurrentToInputWeights,
629 recurrentToForgetWeights,
630 recurrentToCellWeights,
631 recurrentToOutputWeights,
632 hasCellToInputWeights,
633 cellToInputWeights,
634 hasCellToForgetWeights,
635 cellToForgetWeights,
636 hasCellToOutputWeights,
637 cellToOutputWeights,
638 hasInputGateBias,
639 inputGateBias,
640 forgetGateBias,
641 cellBias,
642 outputGateBias,
643 hasProjectionWeights,
644 projectionWeights,
645 hasProjectionBias,
646 projectionBias,
647 hasInputLayerNormWeights,
648 inputLayerNormWeights,
649 hasForgetLayerNormWeights,
650 forgetLayerNormWeights,
651 hasCellLayerNormWeights,
652 cellLayerNormWeights,
653 hasOutputLayerNormWeights,
654 outputLayerNormWeights,
655 inputValues,
656 expectedOutputValues,
657 activationFunction,
658 clippingThresCell,
659 clippingThresProj,
660 isTimeMajor);
661}
662
663void UnidirectionalSequenceLstmNoCifgWithPeepholeWithProjectionWithLayerNormTest(
664 std::vector<armnn::BackendId>& backends)
665{
666 int32_t batchSize = 3;
667 int32_t timeSize = 2;
668 int32_t inputSize = 3;
669 int32_t outputSize = 4;
670 int32_t numUnits = 5;
671
672 //tensorInfo15
673 bool hasInputToInputWeights = true;
674 std::vector<float> inputToInputWeights = { -0.49536117f, -0.0556083915f, -0.102400711f,
675 -0.117484632f, 0.3298470976f, -0.1179017122f,
676 0.214305695f, 0.42135173085f, 0.003878414626f,
677 -0.348303917f, -0.1881275477f, 0.0343011027f,
678 -0.38837709614f, -0.05636804124f, 0.4259087456f};
679
680 std::vector<float> inputToForgetWeights = { 0.2415594226f, 0.15400093799f, 0.4566498398f,
681 -0.3810434485f, 0.268383264f, -0.009807467424f,
682 -0.3522925403f, -0.24275735512f, -0.28344226125f,
683 0.13512269116f, -0.4932442977f, -0.10039821991f,
684 0.2726137042f, 0.09216640889f, -0.06551410215f};
685
686 std::vector<float> inputToCellWeights = { -0.2504855627f, 0.184490025045f, -0.2480507493f,
687 0.386399507f, -0.259465157985f, -0.16545993089f,
688 -0.4230232555f, 0.341664791103f, -0.18127849691f,
689 -0.2277662414f, -0.55275535589f, 0.34184026718f,
690 0.3954237699f, -0.19407111404f, 0.30412107706f};
691
692 std::vector<float> inputToOutputWeights = { 0.2303854227f, 0.5218806862f, -0.4865379333f,
693 0.53969591851f, 0.23393625035f, -0.27140527306f,
694 0.50009280443f, 0.07511717046f, 0.3998299249f,
695 -0.51717478049f, 0.1889653282f, -0.367323637f,
696 -0.12584099173f, -0.12319286912f, 0.2407919466f};
697
698 //tensorInfo20
699 bool hasRecurrentToInputWeights = true;
700 std::vector<float> recurrentToInputWeights = { -0.128009796112f, 0.1995525098f, -0.07745539397f, 0.1558421701f,
701 -0.265254765766f, -0.38837709614f, -0.05636804124f, 0.4259087456f,
702 0.17628988623f, 0.3877420127f, 0.53300309181f, -0.0959980934f,
703 0.00302857416f, 0.3266998827f, -0.142509296562f, -0.04433270756f,
704 0.54066205f, -0.32668582f, -0.43562764f, -0.56094903f };
705
706 std::vector<float> recurrentToForgetWeights = { -0.09499983487f, -0.08814888417f, -0.04834804721f, 0.1516668247f,
707 -0.3967529535f, -0.06463699788f, 0.4952811002f, 0.003274492938f,
708 -0.0968840941f, 0.17928104102f, 0.0031281141592f, -0.3387276584f,
709 -0.3587934076f, 0.06705895066f, 0.22463923692f, 0.1961955726f,
710 0.01841056f, -0.32764608f, -0.33027974f, -0.10826075f };
711
712 std::vector<float> recurrentToCellWeights = { -0.21938985582f, -0.3023648226f, -0.1170005202f, -0.3509177422f,
713 -0.4286288613f, 0.2726137042f, 0.09216640889f, -0.06551410215f,
714 0.20453298098f, 0.2393476665f, 0.11846517771f, 0.2630801796f,
715 0.3954237699f, -0.19407111404f, 0.30412107706f, -0.27342408554f,
716 0.19069612f, -0.03026325f, -0.54532051f, 0.33003211f };
717
718 std::vector<float> recurrentToOutputWeights = { -0.32921677827f, 0.32624614238f, -0.1388191282f, -0.17879831790f,
719 -0.15185534954f, -0.16918526583f, -0.10087361183f, -0.5436913968f,
720 0.016758225858f, 0.30454617738f, -0.41493862867f, -0.005565764375f,
721 -0.12584099173f, -0.12319286912f, 0.2407919466f, -0.08879069983f,
722 0.11178309f, 0.09481031f, -0.26424935f, 0.46261835f };
723 // tensorInfo5
724 bool hasCellToInputWeights = true;
725 std::vector<float> cellToInputWeights = { 0.05f, 0.1f, 0.25f, 0.15f, -0.02f };
726 bool hasCellToForgetWeights = true;
727 std::vector<float> cellToForgetWeights = { -0.02f, -0.15f, -0.25f, -0.03f, 0.15f };
728 bool hasCellToOutputWeights = true;
729 std::vector<float> cellToOutputWeights = { 0.1f, -0.1f, -0.5f, 0.05f, 0.01f };
730
731 bool hasInputGateBias = true;
732 std::vector<float> inputGateBias = { 0.03f, 0.15f, 0.22f, 0.38f, 0.05f };
733 std::vector<float> forgetGateBias = { 0.1f, -0.3f, -0.2f, 0.1f, 0.4f };
734 std::vector<float> cellBias = { -0.05f, 0.72f, 0.25f, 0.08f, 0.1f };
735 std::vector<float> outputGateBias = { 0.05f, -0.01f, 0.2f, 0.1f, -0.2f };
736
737 bool hasProjectionWeights = true;
738 std::vector<float> projectionWeights = { -0.1f, 0.2f, 0.01f, -0.2f,
739 0.1f, 0.5f, 0.3f, 0.08f,
740 0.07f, 0.2f, -0.4f, 0.2f,
741 0.5f, -0.4f, 0.3f, -0.2f,
742 0.3f, 0.08f, -0.07f, 0.2f}; //{outputSize, numUnits}
743 bool hasProjectionBias = true;
744 std::vector<float> projectionBias(outputSize, 0.f);;
745
746 bool hasInputLayerNormWeights = true;
747 std::vector<float> inputLayerNormWeights = { 0.1f, 0.2f, 0.3f, 0.5f, 0.8f };
748 bool hasForgetLayerNormWeights = true;
749 std::vector<float> forgetLayerNormWeights = { 0.1f, 0.2f, 0.3f, 0.5f, 0.2f };
750 bool hasCellLayerNormWeights = true;
751 std::vector<float> cellLayerNormWeights = { 0.7f, 0.2f, 0.3f, 0.8f, 0.5f };
752 bool hasOutputLayerNormWeights = true;
753 std::vector<float> outputLayerNormWeights = { 0.6f, 0.2f, 0.2f, 0.5f, 0.1f };
754
755 std::vector<float> inputValues = { 1., 2., 3., 4., 5., 4.,
756 3., 2., 1., 2., 3., 4.,
757 5., 4., 3., 2., 1., 2. };
758 std::vector<float> expectedOutputValues = { 0.0642256f, 0.0343966f, 0.184122f, 0.114717f,
759 0.11458f, 0.0407109f, 0.300327f, 0.174301f,
760 0.0864761f, 0.0362912f, 0.178635f, 0.115689f,
761 0.108008f, 0.0386623f, 0.273471f, 0.167115f,
762 0.0859545f, 0.0331481f, 0.186051f, 0.11888f,
763 0.106649f, 0.0276847f, 0.229863f, 0.166958f };
764
765 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
766 float clippingThresCell = 10.f;
767 float clippingThresProj = 0.f;
768 bool isTimeMajor = false;
769
770 UnidirectionalSequenceLstmTestImpl<float>(backends,
771 ::tflite::TensorType_FLOAT32,
772 batchSize,
773 timeSize,
774 inputSize,
775 outputSize,
776 numUnits,
777 hasInputToInputWeights,
778 inputToInputWeights,
779 inputToForgetWeights,
780 inputToCellWeights,
781 inputToOutputWeights,
782 hasRecurrentToInputWeights,
783 recurrentToInputWeights,
784 recurrentToForgetWeights,
785 recurrentToCellWeights,
786 recurrentToOutputWeights,
787 hasCellToInputWeights,
788 cellToInputWeights,
789 hasCellToForgetWeights,
790 cellToForgetWeights,
791 hasCellToOutputWeights,
792 cellToOutputWeights,
793 hasInputGateBias,
794 inputGateBias,
795 forgetGateBias,
796 cellBias,
797 outputGateBias,
798 hasProjectionWeights,
799 projectionWeights,
800 hasProjectionBias,
801 projectionBias,
802 hasInputLayerNormWeights,
803 inputLayerNormWeights,
804 hasForgetLayerNormWeights,
805 forgetLayerNormWeights,
806 hasCellLayerNormWeights,
807 cellLayerNormWeights,
808 hasOutputLayerNormWeights,
809 outputLayerNormWeights,
810 inputValues,
811 expectedOutputValues,
812 activationFunction,
813 clippingThresCell,
814 clippingThresProj,
815 isTimeMajor);
816}
817
Narumol Prangnawaratbd575b22021-08-31 16:53:54 +0100818void UnidirectionalSequenceLstmInt8Test(std::vector<armnn::BackendId>& backends)
819{
820 int32_t batchSize = 3;
821 int32_t timeSize = 2;
822 int32_t inputSize = 3;
823 int32_t outputSize = 4;
824 // cellSize and outputSize have the same size when there is no projection.
825 int32_t numUnits = outputSize;
Narumol Prangnawarat7684b182021-08-12 14:48:15 +0100826
Narumol Prangnawaratbd575b22021-08-31 16:53:54 +0100827 //tensorInfo12
828 bool hasInputToInputWeights = true;
829 std::vector<int8_t> inputToInputWeights = { -4, -1, -1, -2, 3, -2, 2, 4, 1, -4, -2, 3 };
830
831 std::vector<int8_t> inputToForgetWeights = { 2, 1, 4, -4, 3, -1, -3, -2, -3, 1, -4, -1 };
832
833 std::vector<int8_t> inputToCellWeights = { -2, 1, -2, 4, -3, -2, -4, 3, -2, -2, -6, 3 };
834
835 std::vector<int8_t> inputToOutputWeights = { 2, 5, -4, 5, 2, -3, 5, 7, 3, -5, 1, -4 };
836
837 //tensorInfo16
838 bool hasRecurrentToInputWeights = true;
839 std::vector<int8_t> recurrentToInputWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -1, -1 };
840
841 std::vector<int8_t> recurrentToForgetWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -2, -1 };
842
843 std::vector<int8_t> recurrentToCellWeights = { -2, -3, -1, -3, -4, 2, 1, -1, 2, 2, 1, 2, 3, -2, 3, -3 };
844
845 std::vector<int8_t> recurrentToOutputWeights = { -3, 3, -1, -2, -2, -2, -1, -5, 1, 3, -4, -1, -1, -1, 2, -1 };
846
847 // tensorInfo4
848 bool hasCellToInputWeights = false;
849 std::vector<int8_t> cellToInputWeights;
850 bool hasCellToForgetWeights = false;
851 std::vector<int8_t> cellToForgetWeights;
852 bool hasCellToOutputWeights = false;
853 std::vector<int8_t> cellToOutputWeights;
854
855 bool hasInputGateBias = true;
856 std::vector<float> inputGateBias = { 0., 0., 0., 0. };
857 std::vector<float> forgetGateBias = { 1., 1., 1., 1. };
858 std::vector<float> cellBias = { 0., 0., 0., 0. };
859 std::vector<float> outputGateBias = { 0., 0., 0., 0. };
860
861 bool hasProjectionWeights = false;
862 std::vector<int8_t> projectionWeights;
863 bool hasProjectionBias = false;
864 std::vector<float> projectionBias;
865
866 bool hasInputLayerNormWeights = false;
867 std::vector<float> inputLayerNormWeights;
868 bool hasForgetLayerNormWeights = false;
869 std::vector<float> forgetLayerNormWeights;
870 bool hasCellLayerNormWeights = false;
871 std::vector<float> cellLayerNormWeights;
872 bool hasOutputLayerNormWeights = false;
873 std::vector<float> outputLayerNormWeights;
874
875 std::vector<float> inputValues = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.4f,
876 0.3f, 0.2f, 0.1f, 0.2f, 0.3f, 0.4f,
877 0.5f, 0.4f, 0.3f, 0.2f, 0.1f, 0.2f };
878
879 std::vector<float> expectedOutputValues = { -0.0142517f, -0.0198845f, -0.0120569f, -0.0116868f,
880 -0.0350714f, -0.0343202f, -0.047504f, -0.0569789f,
881 -0.0146346f, 0.0106663f, -0.0247238f, -0.0319502f,
882 -0.0294759f, -0.0129935f, -0.0444175f, -0.0444354f,
883 -0.0280855f, 0.00545101f, -0.051422f, -0.0463838f,
884 -0.0310702f, 0.00915739f, -0.0625207f, -0.0482648f };
885
886 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
887 float clippingThresCell = 10.f;
888 float clippingThresProj = 0.f;
889 bool isTimeMajor = false;
890
891 UnidirectionalSequenceLstmTestImpl<int8_t>(backends,
892 ::tflite::TensorType_INT8,
893 batchSize,
894 timeSize,
895 inputSize,
896 outputSize,
897 numUnits,
898 hasInputToInputWeights,
899 inputToInputWeights,
900 inputToForgetWeights,
901 inputToCellWeights,
902 inputToOutputWeights,
903 hasRecurrentToInputWeights,
904 recurrentToInputWeights,
905 recurrentToForgetWeights,
906 recurrentToCellWeights,
907 recurrentToOutputWeights,
908 hasCellToInputWeights,
909 cellToInputWeights,
910 hasCellToForgetWeights,
911 cellToForgetWeights,
912 hasCellToOutputWeights,
913 cellToOutputWeights,
914 hasInputGateBias,
915 inputGateBias,
916 forgetGateBias,
917 cellBias,
918 outputGateBias,
919 hasProjectionWeights,
920 projectionWeights,
921 hasProjectionBias,
922 projectionBias,
923 hasInputLayerNormWeights,
924 inputLayerNormWeights,
925 hasForgetLayerNormWeights,
926 forgetLayerNormWeights,
927 hasCellLayerNormWeights,
928 cellLayerNormWeights,
929 hasOutputLayerNormWeights,
930 outputLayerNormWeights,
931 inputValues,
932 expectedOutputValues,
933 activationFunction,
934 clippingThresCell,
935 clippingThresProj,
936 isTimeMajor,
937 0.1f);
938}
939
940void UnidirectionalSequenceLstmInt8TimeMajorTest(std::vector<armnn::BackendId>& backends)
941{
942 int32_t batchSize = 3;
943 int32_t timeSize = 2;
944 int32_t inputSize = 3;
945 int32_t outputSize = 4;
946 // cellSize and outputSize have the same size when there is no projection.
947 int32_t numUnits = outputSize;
948
949 //tensorInfo12
950 bool hasInputToInputWeights = true;
951 std::vector<int8_t> inputToInputWeights = { -4, -1, -1, -2, 3, -2, 2, 4, 1, -4, -2, 3 };
952
953 std::vector<int8_t> inputToForgetWeights = { 2, 1, 4, -4, 3, -1, -3, -2, -3, 1, -4, -1 };
954
955 std::vector<int8_t> inputToCellWeights = { -2, 1, -2, 4, -3, -2, -4, 3, -2, -2, -6, 3 };
956
957 std::vector<int8_t> inputToOutputWeights = { 2, 5, -4, 5, 2, -3, 5, 7, 3, -5, 1, -4 };
958
959 //tensorInfo16
960 bool hasRecurrentToInputWeights = true;
961 std::vector<int8_t> recurrentToInputWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -1, -1 };
962
963 std::vector<int8_t> recurrentToForgetWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -2, -1 };
964
965 std::vector<int8_t> recurrentToCellWeights = { -2, -3, -1, -3, -4, 2, 1, -1, 2, 2, 1, 2, 3, -2, 3, -3 };
966
967 std::vector<int8_t> recurrentToOutputWeights = { -3, 3, -1, -2, -2, -2, -1, -5, 1, 3, -4, -1, -1, -1, 2, -1 };
968
969 // tensorInfo4
970 bool hasCellToInputWeights = false;
971 std::vector<int8_t> cellToInputWeights;
972 bool hasCellToForgetWeights = false;
973 std::vector<int8_t> cellToForgetWeights;
974 bool hasCellToOutputWeights = false;
975 std::vector<int8_t> cellToOutputWeights;
976
977 bool hasInputGateBias = true;
978 std::vector<float> inputGateBias = { 0., 0., 0., 0. };
979 std::vector<float> forgetGateBias = { 1., 1., 1., 1. };
980 std::vector<float> cellBias = { 0., 0., 0., 0. };
981 std::vector<float> outputGateBias = { 0., 0., 0., 0. };
982
983 bool hasProjectionWeights = false;
984 std::vector<int8_t> projectionWeights;
985 bool hasProjectionBias = false;
986 std::vector<float> projectionBias;
987
988 bool hasInputLayerNormWeights = false;
989 std::vector<float> inputLayerNormWeights;
990 bool hasForgetLayerNormWeights = false;
991 std::vector<float> forgetLayerNormWeights;
992 bool hasCellLayerNormWeights = false;
993 std::vector<float> cellLayerNormWeights;
994 bool hasOutputLayerNormWeights = false;
995 std::vector<float> outputLayerNormWeights;
996
997 std::vector<float> inputValues = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.4f,
998 0.3f, 0.2f, 0.1f, 0.2f, 0.3f, 0.4f,
999 0.5f, 0.4f, 0.3f, 0.2f, 0.1f, 0.2f };
1000
1001 std::vector<float> expectedOutputValues = { -0.0142517f, -0.0198845f, -0.0120122f, -0.0116868f,
1002 -0.0261295f, -0.0188487f, -0.0345463f, -0.049733f,
1003 -0.0146346f, 0.0106663f, -0.0247238f, -0.0319502f,
1004 -0.0291863f, -0.0369402f, -0.0354071f, -0.0296529f,
1005 -0.0419539f, -0.00617731f, -0.0814796f, -0.0804005f,
1006 -0.0244737f, 0.0119905f, -0.0457527f, -0.0331862f };
1007
1008 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
1009 float clippingThresCell = 10.f;
1010 float clippingThresProj = 0.f;
1011 bool isTimeMajor = true;
1012
1013 UnidirectionalSequenceLstmTestImpl<int8_t>(backends,
1014 ::tflite::TensorType_INT8,
1015 batchSize,
1016 timeSize,
1017 inputSize,
1018 outputSize,
1019 numUnits,
1020 hasInputToInputWeights,
1021 inputToInputWeights,
1022 inputToForgetWeights,
1023 inputToCellWeights,
1024 inputToOutputWeights,
1025 hasRecurrentToInputWeights,
1026 recurrentToInputWeights,
1027 recurrentToForgetWeights,
1028 recurrentToCellWeights,
1029 recurrentToOutputWeights,
1030 hasCellToInputWeights,
1031 cellToInputWeights,
1032 hasCellToForgetWeights,
1033 cellToForgetWeights,
1034 hasCellToOutputWeights,
1035 cellToOutputWeights,
1036 hasInputGateBias,
1037 inputGateBias,
1038 forgetGateBias,
1039 cellBias,
1040 outputGateBias,
1041 hasProjectionWeights,
1042 projectionWeights,
1043 hasProjectionBias,
1044 projectionBias,
1045 hasInputLayerNormWeights,
1046 inputLayerNormWeights,
1047 hasForgetLayerNormWeights,
1048 forgetLayerNormWeights,
1049 hasCellLayerNormWeights,
1050 cellLayerNormWeights,
1051 hasOutputLayerNormWeights,
1052 outputLayerNormWeights,
1053 inputValues,
1054 expectedOutputValues,
1055 activationFunction,
1056 clippingThresCell,
1057 clippingThresProj,
1058 isTimeMajor,
1059 0.1);
1060}
1061
1062void UnidirectionalSequenceLstmInt8NoCifgWithPeepholeWithProjectionTest(std::vector<armnn::BackendId>& backends)
1063{
1064 int32_t batchSize = 3;
1065 int32_t timeSize = 2;
1066 int32_t inputSize = 3;
1067 int32_t outputSize = 4;
1068 int32_t numUnits = 4;
1069
1070 bool hasInputToInputWeights = true;
1071 std::vector<int8_t> inputToInputWeights = { -4, -1, -1, -2, 3, -2, 2, 4, 1, -4, -2, 3 };
1072
1073 std::vector<int8_t> inputToForgetWeights = { 2, 1, 4, -4, 3, -1, -3, -2, -3, 1, -4, -1 };
1074
1075 std::vector<int8_t> inputToCellWeights = { -2, 1, -2, 4, -3, -2, -4, 3, -2, -2, -6, 3 };
1076
1077 std::vector<int8_t> inputToOutputWeights = { 2, 5, -4, 5, 2, -3, 5, 7, 3, -5, 1, -4 };
1078
1079 //tensorInfo16
1080 bool hasRecurrentToInputWeights = true;
1081 std::vector<int8_t> recurrentToInputWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -1, -1 };
1082
1083 std::vector<int8_t> recurrentToForgetWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -2, -1 };
1084
1085 std::vector<int8_t> recurrentToCellWeights = { -2, -3, -1, -3, -4, 2, 1, -1, 2, 2, 1, 2, 3, -2, 3, -3 };
1086
1087 std::vector<int8_t> recurrentToOutputWeights = { -3, 3, -1, -2, -2, -2, -1, -5, 1, 3, -4, -1, -1, -1, 2, -1 };
1088
1089 // tensorInfo4
1090 bool hasCellToInputWeights = true;
1091 std::vector<int8_t> cellToInputWeights = { 5, 10, 25, 15 };
1092 bool hasCellToForgetWeights = true;
1093 std::vector<int8_t> cellToForgetWeights = { -5, 15, 25, 3 };
1094 bool hasCellToOutputWeights = true;
1095 std::vector<int8_t> cellToOutputWeights = { 10, -10, -5, 50 };
1096
1097 bool hasInputGateBias = true;
1098 std::vector<float> inputGateBias = { 0.02234832f, 0.14757581f, 0.18176508f, 0.10380666f};
1099 std::vector<float> forgetGateBias = { 0.035185695f, -0.042891346f, -0.3032477f, 0.23027696f};
1100 std::vector<float> cellBias = { -0.124379363f, 0.55531194f, 0.23377132f, 0.033463873f };
1101 std::vector<float> outputGateBias = { 0.046159424f, -0.12809046f, 0.03563469f, 0.12648113f };
1102
1103 bool hasProjectionWeights = true;
1104 std::vector<int8_t> projectionWeights = { -25, 51, 3, -5, 25, 127, 77, 20, 18, 51, -10, 51, -25, 88, 77, -13 };
1105 bool hasProjectionBias = true;
1106 std::vector<float> projectionBias(outputSize, 0.f);
1107
1108 bool hasInputLayerNormWeights = false;
1109 std::vector<float> inputLayerNormWeights;
1110 bool hasForgetLayerNormWeights = false;
1111 std::vector<float> forgetLayerNormWeights;
1112 bool hasCellLayerNormWeights = false;
1113 std::vector<float> cellLayerNormWeights;
1114 bool hasOutputLayerNormWeights = false;
1115 std::vector<float> outputLayerNormWeights;
1116
1117 std::vector<float> inputValues = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.4f,
1118 0.3f, 0.2f, 0.1f, 0.2f, 0.3f, 0.4f,
1119 0.5f, 0.4f, 0.3f, 0.2f, 0.1f, 0.2f };
1120
1121 std::vector<float> expectedOutputValues = { 0.612103f, 1.56788f, 0.31966f, 1.42956f,
1122 0.909718f, 3.07916f, -0.560586f, 3.8907f,
1123 0.753671f, 1.77485f, 0.365122f, 1.60077f,
1124 0.812644f, 2.79092f, -0.605396f, 3.61742f,
1125 0.791857f, 1.64353f, 0.316588f, 1.55192f,
1126 0.807265f, 2.47012f, -0.539598f, 3.25654f };
1127
1128 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
1129 float clippingThresCell = 10.f;
1130 float clippingThresProj = 0.f;
1131 bool isTimeMajor = false;
1132
1133 UnidirectionalSequenceLstmTestImpl<int8_t>(backends,
1134 ::tflite::TensorType_INT8,
1135 batchSize,
1136 timeSize,
1137 inputSize,
1138 outputSize,
1139 numUnits,
1140 hasInputToInputWeights,
1141 inputToInputWeights,
1142 inputToForgetWeights,
1143 inputToCellWeights,
1144 inputToOutputWeights,
1145 hasRecurrentToInputWeights,
1146 recurrentToInputWeights,
1147 recurrentToForgetWeights,
1148 recurrentToCellWeights,
1149 recurrentToOutputWeights,
1150 hasCellToInputWeights,
1151 cellToInputWeights,
1152 hasCellToForgetWeights,
1153 cellToForgetWeights,
1154 hasCellToOutputWeights,
1155 cellToOutputWeights,
1156 hasInputGateBias,
1157 inputGateBias,
1158 forgetGateBias,
1159 cellBias,
1160 outputGateBias,
1161 hasProjectionWeights,
1162 projectionWeights,
1163 hasProjectionBias,
1164 projectionBias,
1165 hasInputLayerNormWeights,
1166 inputLayerNormWeights,
1167 hasForgetLayerNormWeights,
1168 forgetLayerNormWeights,
1169 hasCellLayerNormWeights,
1170 cellLayerNormWeights,
1171 hasOutputLayerNormWeights,
1172 outputLayerNormWeights,
1173 inputValues,
1174 expectedOutputValues,
1175 activationFunction,
1176 clippingThresCell,
1177 clippingThresProj,
1178 isTimeMajor,
1179 0.1f);
1180}
1181
1182void UnidirectionalSequenceLstmInt8WithCifgWithPeepholeNoProjectionTest(std::vector<armnn::BackendId>& backends)
1183{
1184 int32_t batchSize = 3;
1185 int32_t timeSize = 2;
1186 int32_t inputSize = 3;
1187 int32_t outputSize = 4;
1188 // cellSize and outputSize have the same size when there is no projection.
1189 int32_t numUnits = outputSize;
1190
1191 //tensorInfo12,
1192 bool hasInputToInputWeights = false;
1193 std::vector<int8_t> inputToInputWeights;
1194
1195 std::vector<int8_t> inputToForgetWeights = { 2, 1, 4, -4, 3, -1, -3, -2, -3, 1, -4, -1 };
1196
1197 std::vector<int8_t> inputToCellWeights = { -2, 1, -2, 4, -3, -2, -4, 3, -2, -2, -6, 3 };
1198
1199 std::vector<int8_t> inputToOutputWeights = { 2, 5, -4, 5, 2, -3, 5, 7, 3, -5, 1, -4 };
1200
1201 //tensorInfo16,
1202 bool hasRecurrentToInputWeights = false;
1203 std::vector<int8_t> recurrentToInputWeights;
1204 std::vector<int8_t> recurrentToForgetWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3, 5, -1, 1, 3, -2, -1 };
1205
1206 std::vector<int8_t> recurrentToCellWeights = { -2, -3, -1, -3, -4, 2, 1, -1, 2, 2, 1, 2, 3, -2, 3, -3 };
1207
1208 std::vector<int8_t> recurrentToOutputWeights = { -3, 3, -1, -2, -2, -2, -1, -5, 1, 3, -4, -1, -1, -1, 2, -1 };
1209
1210 // tensorInfo4
1211 bool hasCellToInputWeights = false;
1212 std::vector<int8_t> cellToInputWeights;
1213 bool hasCellToForgetWeights = true;
1214 std::vector<int8_t> cellToForgetWeights = { 47, -52, -24, 31 };
1215 bool hasCellToOutputWeights = true;
1216 std::vector<int8_t> cellToOutputWeights = { -17, 82, 85, -77 };
1217
1218 bool hasInputGateBias = false;
1219 std::vector<float> inputGateBias;
1220 std::vector<float> forgetGateBias = { 1., 1., 1., 1. };
1221 std::vector<float> cellBias = { 0., 0., 0., 0. };
1222 std::vector<float> outputGateBias = { 0., 0., 0., 0. };
1223
1224 bool hasProjectionWeights = false;
1225 std::vector<int8_t> projectionWeights;
1226 bool hasProjectionBias = false;
1227 std::vector<float> projectionBias;
1228
1229 bool hasInputLayerNormWeights = false;
1230 std::vector<float> inputLayerNormWeights;
1231 bool hasForgetLayerNormWeights = false;
1232 std::vector<float> forgetLayerNormWeights;
1233 bool hasCellLayerNormWeights = false;
1234 std::vector<float> cellLayerNormWeights;
1235 bool hasOutputLayerNormWeights = false;
1236 std::vector<float> outputLayerNormWeights;
1237
1238 std::vector<float> inputValues = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.4f,
1239 0.3f, 0.2f, 0.1f, 0.2f, 0.3f, 0.4f,
1240 0.5f, 0.4f, 0.3f, 0.2f, 0.1f, 0.2f };
1241
1242 std::vector<float> expectedOutputValues = { -0.0072104f, -0.00991171f, -0.00650478f, -0.00713055f,
1243 -0.0191782f, -0.0161269f, -0.0233683f, -0.054299f,
1244 -0.00783725f, 0.00635271f, -0.0126718f, -0.022613f,
1245 -0.0161351f, -0.00775868f, -0.021054f, -0.0339778f,
1246 -0.0146392f, 0.00330261f, -0.0258733f, -0.0407797f,
1247 -0.0174297f, 0.0050105f, -0.0266275f, -0.0362564f };
1248
1249 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
1250 float clippingThresCell = 10.f;
1251 float clippingThresProj = 0.f;
1252 bool isTimeMajor = false;
1253
1254 UnidirectionalSequenceLstmTestImpl<int8_t>(backends,
1255 ::tflite::TensorType_INT8,
1256 batchSize,
1257 timeSize,
1258 inputSize,
1259 outputSize,
1260 numUnits,
1261 hasInputToInputWeights,
1262 inputToInputWeights,
1263 inputToForgetWeights,
1264 inputToCellWeights,
1265 inputToOutputWeights,
1266 hasRecurrentToInputWeights,
1267 recurrentToInputWeights,
1268 recurrentToForgetWeights,
1269 recurrentToCellWeights,
1270 recurrentToOutputWeights,
1271 hasCellToInputWeights,
1272 cellToInputWeights,
1273 hasCellToForgetWeights,
1274 cellToForgetWeights,
1275 hasCellToOutputWeights,
1276 cellToOutputWeights,
1277 hasInputGateBias,
1278 inputGateBias,
1279 forgetGateBias,
1280 cellBias,
1281 outputGateBias,
1282 hasProjectionWeights,
1283 projectionWeights,
1284 hasProjectionBias,
1285 projectionBias,
1286 hasInputLayerNormWeights,
1287 inputLayerNormWeights,
1288 hasForgetLayerNormWeights,
1289 forgetLayerNormWeights,
1290 hasCellLayerNormWeights,
1291 cellLayerNormWeights,
1292 hasOutputLayerNormWeights,
1293 outputLayerNormWeights,
1294 inputValues,
1295 expectedOutputValues,
1296 activationFunction,
1297 clippingThresCell,
1298 clippingThresProj,
1299 isTimeMajor,
1300 0.1);
1301}
1302
1303void UnidirectionalSequenceLstmInt8NoCifgWithPeepholeWithProjectionWithLayerNormTest(
1304 std::vector<armnn::BackendId>& backends)
1305{
1306 int32_t batchSize = 3;
1307 int32_t timeSize = 2;
1308 int32_t inputSize = 3;
1309 int32_t outputSize = 4;
1310 int32_t numUnits = 5;
1311
1312 bool hasInputToInputWeights = true;
1313 std::vector<int8_t> inputToInputWeights = { -4, -1, -1, -2, 3, -2, 2, 4, 1, -4, -2, 3, 2, 2, -4 };
1314
1315 std::vector<int8_t> inputToForgetWeights = { 2, 1, 4, -4, 3, -1, -3, -2, -3, 1, -4, -1, -3, -2, -4 };
1316
1317 std::vector<int8_t> inputToCellWeights = { -2, 1, -2, 4, -3, -2, -4, 3, -2, -2, -6, 3, 2, 5, -4 };
1318
1319 std::vector<int8_t> inputToOutputWeights = { 2, 5, -4, 5, 2, -3, 5, 7, 3, -5, 1, -4, -4, -1, -1 };
1320
1321 bool hasRecurrentToInputWeights = true;
1322 std::vector<int8_t> recurrentToInputWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3,
1323 5, -1, 1, 3, -1, -1, -1, 4, 2, 3 };
1324
1325 std::vector<int8_t> recurrentToForgetWeights = { -1, 1, -1, 1, -3, -4, -1, 4, 2, 3,
1326 5, -1, 1, 3, -2, -1, -1, 2, 2, 1 };
1327
1328 std::vector<int8_t> recurrentToCellWeights = { -2, -3, -1, -3, -4, 2, 1, -1, 2, 2,
1329 1, 2, 3, -2, 3, -3, -1, -5, 1, 3 };
1330
1331 std::vector<int8_t> recurrentToOutputWeights = { -3, 3, -1, -2, -2, -2, -1, -5, 1, 3,
1332 -4, -1, -1, -1, 2, -1, 5, 1, -3, -4 };
1333
1334 // tensorInfo5
1335 bool hasCellToInputWeights = true;
1336 std::vector<int8_t> cellToInputWeights = { 5, 3, 8, -5, 2 };
1337 bool hasCellToForgetWeights = true;
1338 std::vector<int8_t> cellToForgetWeights = { -2, -7, 5, -3, 4 };
1339 bool hasCellToOutputWeights = true;
1340 std::vector<int8_t> cellToOutputWeights = { 9, -10 , -5, 5, 1 };
1341
1342 bool hasInputGateBias = true;
1343 std::vector<float> inputGateBias = { 0.03f, 0.15f, 0.22f, 0.38f, 0.05f };
1344 std::vector<float> forgetGateBias = { 0.1f, -0.3f, -0.2f, 0.1f, 0.4f };
1345 std::vector<float> cellBias = { -0.05f, 0.72f, 0.25f, 0.08f, 0.1f };
1346 std::vector<float> outputGateBias = { 0.05f, -0.01f, 0.2f, 0.1f, -0.2f };
1347
1348 bool hasProjectionWeights = true;
1349 std::vector<int8_t> projectionWeights = { -1, 2, 1, -2, 1, 5, 3, 8, 7, 2,
1350 -4, 2, 5, -4, 3, -2, 3, 8, -7, 2 };
1351 bool hasProjectionBias = true;
1352 std::vector<float> projectionBias(outputSize, 0.f);
1353
1354 bool hasInputLayerNormWeights = true;
1355 std::vector<float> inputLayerNormWeights = { 0.1f, 0.2f, -0.3f, -0.1f, 0.5f };
1356 bool hasForgetLayerNormWeights = true;
1357 std::vector<float> forgetLayerNormWeights = { -0.1f, 0.2f, 0.3f, 0.5f, 0.2f };
1358 bool hasCellLayerNormWeights = true;
1359 std::vector<float> cellLayerNormWeights = { 0.5f, 0.2f, 0.3f, 0.4f, -0.5f };
1360 bool hasOutputLayerNormWeights = true;
1361 std::vector<float> outputLayerNormWeights = { 0.6f, -0.2f, -0.2f, 0.5f, 0.1f };
1362
1363 std::vector<float> inputValues = { 1., 8., 3., 4., 5., 4.,
1364 3., 2., 1., 2., 3., 4.,
1365 5., 4., 3., 2., 1., 2. };
1366
1367 std::vector<float> expectedOutputValues = { 0.0471276f, 0.0168155f, 0.0789885f, 0.16550f,
1368 0.0643133f, -0.0400722f, 0.100593f, 0.197722f,
1369 0.0465562f, -0.0600682f, 0.0622087f, 0.115053f,
1370 0.056287f, -0.0566218f, 0.0856832f, 0.148484f,
1371 0.0457859f, -0.0588112f, 0.0623636f, 0.114333f,
1372 0.0509271f, -0.0754262f, 0.058600f, 0.0801288f };
1373
1374 tflite::ActivationFunctionType activationFunction = tflite::ActivationFunctionType_TANH;
1375 float clippingThresCell = 10.f;
1376 float clippingThresProj = 0.f;
1377 bool isTimeMajor = false;
1378
1379 UnidirectionalSequenceLstmTestImpl<int8_t>(backends,
1380 ::tflite::TensorType_INT8,
1381 batchSize,
1382 timeSize,
1383 inputSize,
1384 outputSize,
1385 numUnits,
1386 hasInputToInputWeights,
1387 inputToInputWeights,
1388 inputToForgetWeights,
1389 inputToCellWeights,
1390 inputToOutputWeights,
1391 hasRecurrentToInputWeights,
1392 recurrentToInputWeights,
1393 recurrentToForgetWeights,
1394 recurrentToCellWeights,
1395 recurrentToOutputWeights,
1396 hasCellToInputWeights,
1397 cellToInputWeights,
1398 hasCellToForgetWeights,
1399 cellToForgetWeights,
1400 hasCellToOutputWeights,
1401 cellToOutputWeights,
1402 hasInputGateBias,
1403 inputGateBias,
1404 forgetGateBias,
1405 cellBias,
1406 outputGateBias,
1407 hasProjectionWeights,
1408 projectionWeights,
1409 hasProjectionBias,
1410 projectionBias,
1411 hasInputLayerNormWeights,
1412 inputLayerNormWeights,
1413 hasForgetLayerNormWeights,
1414 forgetLayerNormWeights,
1415 hasCellLayerNormWeights,
1416 cellLayerNormWeights,
1417 hasOutputLayerNormWeights,
1418 outputLayerNormWeights,
1419 inputValues,
1420 expectedOutputValues,
1421 activationFunction,
1422 clippingThresCell,
1423 clippingThresProj,
1424 isTimeMajor,
1425 0.1);
1426}
Narumol Prangnawarat7684b182021-08-12 14:48:15 +01001427
1428TEST_SUITE("UnidirectionalSequenceLstmTest_CpuRefTests")
1429{
1430
1431TEST_CASE ("UnidirectionalSequenceLstmTest_CpuRef_Test")
1432{
1433 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1434 UnidirectionalSequenceLstmTest(backends);
1435}
1436
1437TEST_CASE ("UnidirectionalSequenceLstmTimeMajorTest_CpuRef_Test")
1438{
1439 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1440 UnidirectionalSequenceLstmTimeMajorTest(backends);
1441}
1442
Narumol Prangnawarat5f941242023-08-11 16:09:26 +01001443TEST_CASE ("UnidirectionalSequenceLstmTimeMajorSingleTimeTest_CpuRef_Test")
1444{
1445 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1446 UnidirectionalSequenceLstmTimeMajorSingleTimeTest(backends);
1447}
1448
Narumol Prangnawarat7684b182021-08-12 14:48:15 +01001449TEST_CASE ("UnidirectionalSequenceLstmNoCifgWithPeepholeWithProjectionTest_CpuRef_Test")
1450{
1451 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1452 UnidirectionalSequenceLstmNoCifgWithPeepholeWithProjectionTest(backends);
1453}
1454
1455TEST_CASE ("UnidirectionalSequenceLstmWithCifgWithPeepholeNoProjectionTest_CpuRef_Test")
1456{
1457 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1458 UnidirectionalSequenceLstmWithCifgWithPeepholeNoProjectionTest(backends);
1459}
1460
1461TEST_CASE ("UnidirectionalSequenceLstmNoCifgWithPeepholeWithProjectionWithLayerNormTest_CpuRef_Test")
1462{
1463 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1464 UnidirectionalSequenceLstmNoCifgWithPeepholeWithProjectionWithLayerNormTest(backends);
1465}
1466
Narumol Prangnawaratbd575b22021-08-31 16:53:54 +01001467TEST_CASE ("UnidirectionalSequenceLstmInt8Test_CpuRef_Test")
1468{
1469 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1470 UnidirectionalSequenceLstmInt8Test(backends);
1471}
1472
1473TEST_CASE ("UnidirectionalSequenceLstmTimeInt8TimeMajorTest_CpuRef_Test")
1474{
1475 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1476 UnidirectionalSequenceLstmInt8TimeMajorTest(backends);
1477}
1478
1479TEST_CASE ("UnidirectionalSequenceLstmInt8NoCifgWithPeepholeWithProjectionTest_CpuRef_Test")
1480{
1481 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1482 UnidirectionalSequenceLstmInt8NoCifgWithPeepholeWithProjectionTest(backends);
1483}
1484
1485TEST_CASE ("UnidirectionalSequenceLstmInt8WithCifgWithPeepholeNoProjectionTest_CpuRef_Test")
1486{
1487 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1488 UnidirectionalSequenceLstmInt8WithCifgWithPeepholeNoProjectionTest(backends);
1489}
1490
1491TEST_CASE ("UnidirectionalSequenceLstmInt8NoCifgWithPeepholeWithProjectionWithLayerNormTest_CpuRef_Test")
1492{
1493 std::vector <armnn::BackendId> backends = {armnn::Compute::CpuRef};
1494 UnidirectionalSequenceLstmInt8NoCifgWithPeepholeWithProjectionWithLayerNormTest(backends);
1495}
1496
Narumol Prangnawarat7684b182021-08-12 14:48:15 +01001497} //End of TEST_SUITE("UnidirectionalSequenceLstmTest_CpuRef")
1498
1499} // namespace armnnDelegate