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