@@ -30,6 +30,20 @@ extern mli::tst::tensor_quantizer input_2_sa8;
3030extern mli::tst::tensor_quantizer input_2_sa32;
3131extern mli::tst::tensor_quantizer input_2_fp32;
3232
33+ // Extracted Output vectors Declaration
34+ // ===================================================
35+ extern mli::tst::tensor_quantizer test_1_out_fx16;
36+ extern mli::tst::tensor_quantizer test_1_out_fx8;
37+ extern mli::tst::tensor_quantizer test_1_out_sa8;
38+ extern mli::tst::tensor_quantizer test_1_out_sa8_per_axis;
39+ extern mli::tst::tensor_quantizer test_1_out_sa32;
40+ extern mli::tst::tensor_quantizer test_1_out_sa32_per_axis;
41+ extern mli::tst::tensor_quantizer test_1_out_fp32;
42+
43+ // Tests configuration structures Declaration
44+ // ========================================
45+ extern const mli_sub_tensor_cfg test_1_cfg;
46+ extern const mli_sub_tensor_cfg test_2_cfg;
3347
3448// Generated input vectors
3549// ========================================
@@ -199,3 +213,177 @@ tensor_quantizer input_2_sa32(input_2_tsr_sa32, input_2_sa_dim, input_2_data,
199213 &input_2_zero_point, 1, input_2_scale_frac, 1);
200214
201215tensor_quantizer input_2_fp32 (input_2_tsr_fp32, (float *)input_2_data, sizeof(input_2_data) / sizeof(input_2_data[0 ]));
216+
217+ // Extracted Output vectors
218+ // ===================================================
219+
220+ static const float test_1_out_data[] = {
221+ 0 .061785f , -0 .247152f , 0 .193333f , -0 .010555f , -0 .124796f , 0 .038729f , 0 .018775f , 0 .000024f
222+ };
223+
224+ static const float test_1_out_scales[] = {0 .0017931332f , 0 .0023502372f };
225+ static const float test_1_out_zero_points[] = {0 .0f , 0 .0f };
226+ static const int8_t test_1_out_scales_frac[] = {22 , 23 };
227+ static const int test_1_out_sa_dim_per_axis = 3 ;
228+
229+ #define TEST_1_OUT_TSR_SHARED_DESCR \
230+ /* .data = */ { 0 },\
231+ /* .mem_stride = */ {(3 * (3 * 2 )) * 2 , 3 * 2 , 3 , 1 }, \
232+ /* .shape = */ {2 , 2 , 1 , 2 }, \
233+ /* .rank = */ 4
234+
235+ static const mli_tensor test_1_out_tsr_fx16 = {
236+ TEST_1_OUT_TSR_SHARED_DESCR,
237+
238+ /* .el_type = */ MLI_EL_FX_16,
239+ /* .el_params = */ { 0 }
240+ };
241+
242+ static const mli_tensor test_1_out_tsr_fx8 = {
243+ TEST_1_OUT_TSR_SHARED_DESCR,
244+
245+ /* .el_type = */ MLI_EL_FX_8,
246+ /* .el_params = */ { 0 }
247+ };
248+
249+ static const mli_tensor test_1_out_tsr_sa8 = {
250+ TEST_1_OUT_TSR_SHARED_DESCR,
251+
252+ /* .el_type = */ MLI_EL_SA_8,
253+ /* .el_params = */ { 0 }
254+ };
255+
256+ static const mli_tensor test_1_out_tsr_sa32 = {
257+ TEST_1_OUT_TSR_SHARED_DESCR,
258+
259+ /* .el_type = */ MLI_EL_SA_32,
260+ /* .el_params = */ { 0 }
261+ };
262+
263+ static const mli_tensor test_1_out_tsr_fp32 = {
264+ TEST_1_OUT_TSR_SHARED_DESCR,
265+
266+ /* .el_type = */ MLI_EL_FP_32,
267+ /* .el_params = */ { 0 }
268+ };
269+
270+ tensor_quantizer test_1_out_fx16 (test_1_out_tsr_fx16, input_1_fx16_frac, test_1_out_data,
271+ sizeof (test_1_out_data) / sizeof(test_1_out_data[0 ]));
272+
273+ tensor_quantizer test_1_out_fx8 (test_1_out_tsr_fx8, input_1_fx8_frac, test_1_out_data,
274+ sizeof (test_1_out_data) / sizeof(test_1_out_data[0 ]));
275+
276+ tensor_quantizer test_1_out_sa8 (test_1_out_tsr_sa8, input_1_sa_dim, test_1_out_data,
277+ sizeof (test_1_out_data) / sizeof(test_1_out_data[0 ]), &input_1_scale, 1,
278+ &input_1_zero_point, 1, input_1_scale_frac, 1);
279+
280+ tensor_quantizer test_1_out_sa8_per_axis (test_1_out_tsr_sa8, test_1_out_sa_dim_per_axis, test_1_out_data,
281+ sizeof (test_1_out_data) / sizeof(test_1_out_data[0 ]), test_1_out_scales,
282+ sizeof(test_1_out_scales) / sizeof(test_1_out_scales[0 ]), test_1_out_zero_points,
283+ sizeof(test_1_out_zero_points) / sizeof(test_1_out_zero_points[0 ]), test_1_out_scales_frac,
284+ sizeof(test_1_out_scales_frac) / sizeof(test_1_out_scales_frac[0 ]));
285+
286+ tensor_quantizer test_1_out_sa32 (test_1_out_tsr_sa32, input_1_sa_dim, test_1_out_data,
287+ sizeof (test_1_out_data) / sizeof(test_1_out_data[0 ]), &input_1_scale, 1,
288+ &input_1_zero_point, 1, input_1_scale_frac, 1);
289+
290+ tensor_quantizer test_1_out_sa32_per_axis (test_1_out_tsr_sa32, test_1_out_sa_dim_per_axis, test_1_out_data,
291+ sizeof (test_1_out_data) / sizeof(test_1_out_data[0 ]), test_1_out_scales,
292+ sizeof(test_1_out_scales) / sizeof(test_1_out_scales[0 ]), test_1_out_zero_points,
293+ sizeof(test_1_out_zero_points) / sizeof(test_1_out_zero_points[0 ]), test_1_out_scales_frac,
294+ sizeof(test_1_out_scales_frac) / sizeof(test_1_out_scales_frac[0 ]));
295+
296+
297+
298+ static const float test_2_out_data[] = {
299+ -0 .298480f , 0 .330821f , -0 .190452f , 0 .063674f , 0 .239669f , 0 .527339f
300+ };
301+
302+ static const float test_2_out_scales[] = {0 .0023502372f , 0 .004152277f };
303+ static const float test_2_out_zero_points[] = {0 .0f , 0 .0f };
304+ static const int8_t test_2_out_scales_frac[] = {23 , 21 };
305+ static const int test_2_out_sa_dim_per_axis = 2 ;
306+
307+ #define TEST_2_OUT_TSR_SHARED_DESCR \
308+ /* .data = */ { 0 },\
309+ /* .mem_stride = */ { 3 * 2 , 3 , 1 }, \
310+ /* .shape = */ {3 , 1 , 2 }, \
311+ /* .rank = */ 3
312+
313+ static const mli_tensor test_2_out_tsr_fx16 = {
314+ TEST_2_OUT_TSR_SHARED_DESCR,
315+
316+ /* .el_type = */ MLI_EL_FX_16,
317+ /* .el_params = */ { 0 }
318+ };
319+
320+ static const mli_tensor test_2_out_tsr_fx8 = {
321+ TEST_2_OUT_TSR_SHARED_DESCR,
322+
323+ /* .el_type = */ MLI_EL_FX_8,
324+ /* .el_params = */ { 0 }
325+ };
326+
327+ static const mli_tensor test_2_out_tsr_sa8 = {
328+ TEST_2_OUT_TSR_SHARED_DESCR,
329+
330+ /* .el_type = */ MLI_EL_SA_8,
331+ /* .el_params = */ { 0 }
332+ };
333+
334+ static const mli_tensor test_2_out_tsr_sa32 = {
335+ TEST_2_OUT_TSR_SHARED_DESCR,
336+
337+ /* .el_type = */ MLI_EL_SA_32,
338+ /* .el_params = */ { 0 }
339+ };
340+
341+ static const mli_tensor test_2_out_tsr_fp32 = {
342+ TEST_2_OUT_TSR_SHARED_DESCR,
343+
344+ /* .el_type = */ MLI_EL_FP_32,
345+ /* .el_params = */ { 0 }
346+ };
347+
348+ tensor_quantizer test_2_out_fx16 (test_2_out_tsr_fx16, input_1_fx16_frac, test_2_out_data,
349+ sizeof (test_2_out_data) / sizeof(test_2_out_data[0 ]));
350+
351+ tensor_quantizer test_2_out_fx8 (test_2_out_tsr_fx8, input_1_fx8_frac, test_2_out_data,
352+ sizeof (test_2_out_data) / sizeof(test_2_out_data[0 ]));
353+
354+ tensor_quantizer test_2_out_sa8 (test_2_out_tsr_sa8, input_1_sa_dim, test_2_out_data,
355+ sizeof (test_2_out_data) / sizeof(test_2_out_data[0 ]), &input_1_scale, 1,
356+ &input_1_zero_point, 1, input_1_scale_frac, 1);
357+
358+ tensor_quantizer test_2_out_sa8_per_axis (test_2_out_tsr_sa8, test_2_out_sa_dim_per_axis, test_2_out_data,
359+ sizeof (test_2_out_data) / sizeof(test_2_out_data[0 ]), test_2_out_scales,
360+ sizeof(test_2_out_scales) / sizeof(test_2_out_scales[0 ]), test_2_out_zero_points,
361+ sizeof(test_2_out_zero_points) / sizeof(test_2_out_zero_points[0 ]), test_2_out_scales_frac,
362+ sizeof(test_2_out_scales_frac) / sizeof(test_2_out_scales_frac[0 ]));
363+
364+ tensor_quantizer test_2_out_sa32 (test_2_out_tsr_sa32, input_1_sa_dim, test_2_out_data,
365+ sizeof (test_2_out_data) / sizeof(test_2_out_data[0 ]), &input_1_scale, 1,
366+ &input_1_zero_point, 1, input_1_scale_frac, 1);
367+
368+ tensor_quantizer test_2_out_sa32_per_axis (test_2_out_tsr_sa32, test_2_out_sa_dim_per_axis, test_2_out_data,
369+ sizeof (test_2_out_data) / sizeof(test_2_out_data[0 ]), test_2_out_scales,
370+ sizeof(test_2_out_scales) / sizeof(test_2_out_scales[0 ]), test_1_out_zero_points,
371+ sizeof(test_1_out_zero_points) / sizeof(test_1_out_zero_points[0 ]), test_1_out_scales_frac,
372+ sizeof(test_1_out_scales_frac) / sizeof(test_1_out_scales_frac[0 ]));
373+
374+
375+
376+ // Tests configuration structures
377+ // ========================================
378+
379+ const mli_sub_tensor_cfg test_1_cfg = {
380+ /* offset = */ { 0 },
381+ /* size = */ {2 , 2 , 1 , 2 },
382+ /* sub_tensor_rank = */ 4
383+ };
384+
385+ const mli_sub_tensor_cfg test_2_cfg = {
386+ /* offset = */ { 1 , 2 , 0 , 1 },
387+ /* size = */ { 3 , 1 , 1 , 2 },
388+ /* sub_tensor_rank = */ 3
389+ };
0 commit comments