@@ -110,7 +110,7 @@ bool run_test_count_and_size() {
110110 if (is_test_passed && (tensor_quantizer::validate_tensor (input) != tensor_quantizer::kOk )) {
111111 is_test_passed = false ;
112112 reporter.report_case (cur_test->descr ,
113- " At quantization step: more memory for in tensor is be required" , is_test_passed);
113+ " At quantization step: more memory for in tensor is required" , is_test_passed);
114114 }
115115
116116 if (is_test_passed && (mem_in_keeper.is_memory_corrupted ())) {
@@ -138,7 +138,7 @@ bool run_test_count_and_size() {
138138 mem_in_keeper.is_memory_corrupted ())) {
139139 is_test_passed = false ;
140140 reporter.report_case (cur_test->descr ,
141- " At function run: memory is corrupted after functions invokation " , is_test_passed);
141+ " At function run: memory is corrupted after functions invocation " , is_test_passed);
142142 }
143143
144144 if (is_test_passed && cur_test->elem_size != cur_elem_size ) {
@@ -239,7 +239,7 @@ bool run_test_quant_params_getters() {
239239 mem_in_keeper.is_memory_corrupted ())) {
240240 is_test_passed = false ;
241241 reporter.report_case (cur_test->descr ,
242- " FAILED at func run: memory is corrupted after functions invokation " , is_test_passed);
242+ " FAILED at func run: memory is corrupted after functions invocation " , is_test_passed);
243243 }
244244
245245 if (is_test_passed) {
@@ -362,32 +362,41 @@ struct create_subtensor_test_operands {
362362const crc32_calc test_1_chksum_fx16 { 0x418F5ED6 }, test_1_chksum_fx8 { 0x0820E5D9 },
363363 test_1_chksum_sa8 { 0xBB54537D }, test_1_chksum_sa8_pa { 0x63BAA2A1 },
364364 test_1_chksum_sa32 { 0xDC93E12C }, test_1_chksum_sa32_pa { 0x98D5A2D6 },
365- test_2_chksum_fx16 { 0xD7B05DED }, test_2_chksum_fx8 { 0x7582D890 },
366- test_2_chksum_sa8 { 0x4CB81C56 }, test_2_chksum_sa8_pa { 0x2F0B06B8 },
365+ test_2_chksum_fx16 { 0xD7B05DED }, test_2_chksum_fx8 { 0x7582D890 },
366+ test_2_chksum_sa8 { 0x4CB81C56 }, test_2_chksum_sa8_pa { 0x2F0B06B8 },
367367 test_2_chksum_sa32 { 0x0B379B11 }, test_2_chksum_sa32_pa { 0x87591FC2 };
368368
369- const quality_metrics thresholds_test_1_general{ quality_metrics::kPassValueMaxAbsErr , quality_metrics::kPassValueSnr ,
370- /* SNR_DB = */ 35 .9f , quality_metrics::kPassValueQuantErrPerc };
371-
372- const quality_metrics thresholds_test_2_general{ quality_metrics::kPassValueMaxAbsErr , quality_metrics::kPassValueSnr ,
373- /* SNR_DB = */ 41 .3f , quality_metrics::kPassValueQuantErrPerc };
369+ const quality_metrics thresholds_test_general { quality_metrics::kPassValueMaxAbsErr , quality_metrics::kPassValueSnr ,
370+ quality_metrics::kPassValueSnrDb , /* QuantErrPerc = */ 100 .0f };
374371
375372bool run_test_create_subtensor () {
376373 bool test_status = true ;
377374 const reporter_full reporter;
378375 static const create_subtensor_test_operands create_subtensor_tests_list[] = {
379- {" FX16 tensor " , input_1_fx16, test_1_out_fx16, test_1_cfg, thresholds_test_1_general, test_1_chksum_fx16},
380- {" FX8 tensor " , input_1_fx8, test_1_out_fx8, test_1_cfg, thresholds_test_1_general, test_1_chksum_fx8},
381- {" SA8 tensor " , input_1_sa8, test_1_out_sa8, test_1_cfg, thresholds_test_1_general, test_1_chksum_sa8},
382- {" SA8 tensor per axis" , input_1_sa8_per_axis, test_1_out_sa8_per_axis, test_1_cfg, thresholds_test_1_general, test_1_chksum_sa8_pa},
383- {" SA32 tensor " , input_1_sa32, test_1_out_sa32, test_1_cfg, thresholds_test_1_general, test_1_chksum_sa32},
384- {" SA32 tensor per axis" , input_1_sa32_per_axis, test_1_out_sa32_per_axis, test_1_cfg, thresholds_test_1_general, test_1_chksum_sa32_pa},
385- {" FX16 tensor (rank & offset) " , input_1_fx16, test_2_out_fx16, test_2_cfg, thresholds_test_2_general, test_2_chksum_fx16},
386- {" FX8 tensor (rank & offset)" , input_1_fx8, test_2_out_fx8, test_2_cfg, thresholds_test_2_general, test_2_chksum_fx8},
387- {" SA8 tensor (rank & offset)" , input_1_sa8, test_2_out_sa8, test_2_cfg, thresholds_test_2_general, test_2_chksum_sa8},
388- {" SA8 per axis (rank & offset)" , input_1_sa8_per_axis, test_2_out_sa8_per_axis, test_2_cfg, thresholds_test_2_general, test_2_chksum_sa8_pa},
389- {" SA32 tensor (rank & offset)" , input_1_sa32, test_2_out_sa32, test_2_cfg, thresholds_test_2_general, test_2_chksum_sa32},
390- {" SA32 per axis (rank & offset)" , input_1_sa32_per_axis, test_2_out_sa32_per_axis, test_2_cfg, thresholds_test_2_general, test_2_chksum_sa32_pa}
376+ {" FX16 tensor " , input_1_fx16, test_1_out_fx16, test_1_cfg,
377+ thresholds_test_general, test_1_chksum_fx16},
378+ {" FX8 tensor " , input_1_fx8, test_1_out_fx8, test_1_cfg,
379+ thresholds_test_general, test_1_chksum_fx8},
380+ {" SA8 tensor " , input_1_sa8, test_1_out_sa8, test_1_cfg,
381+ thresholds_test_general, test_1_chksum_sa8},
382+ {" SA8 tensor per axis" , input_1_sa8_per_axis, test_1_out_sa8_per_axis, test_1_cfg,
383+ thresholds_test_general, test_1_chksum_sa8_pa},
384+ {" SA32 tensor " , input_1_sa32, test_1_out_sa32, test_1_cfg,
385+ thresholds_test_general, test_1_chksum_sa32},
386+ {" SA32 tensor per axis" , input_1_sa32_per_axis, test_1_out_sa32_per_axis, test_1_cfg,
387+ thresholds_test_general, test_1_chksum_sa32_pa},
388+ {" FX16 tensor (rank & offset) " , input_1_fx16, test_2_out_fx16, test_2_cfg,
389+ thresholds_test_general, test_2_chksum_fx16},
390+ {" FX8 tensor (rank & offset)" , input_1_fx8, test_2_out_fx8, test_2_cfg,
391+ thresholds_test_general, test_2_chksum_fx8},
392+ {" SA8 tensor (rank & offset)" , input_1_sa8, test_2_out_sa8, test_2_cfg,
393+ thresholds_test_general, test_2_chksum_sa8},
394+ {" SA8 per axis (rank & offset)" , input_1_sa8_per_axis, test_2_out_sa8_per_axis, test_2_cfg,
395+ thresholds_test_general, test_2_chksum_sa8_pa},
396+ {" SA32 tensor (rank & offset)" , input_1_sa32, test_2_out_sa32, test_2_cfg,
397+ thresholds_test_general, test_2_chksum_sa32},
398+ {" SA32 per axis (rank & offset)" , input_1_sa32_per_axis, test_2_out_sa32_per_axis, test_2_cfg,
399+ thresholds_test_general, test_2_chksum_sa32_pa}
391400 };
392401 constexpr int kTestsNum = sizeof (create_subtensor_tests_list) / sizeof (create_subtensor_tests_list[0 ]);
393402
@@ -405,43 +414,42 @@ bool run_test_create_subtensor() {
405414 }
406415
407416 const mli_tensor input = cur_test->in .get_quantized_tensor (mem_in_keeper.allocate_memory (cur_test->in ));
408- mli_tensor out = cur_test-> out . get_not_quantized_tensor (mem_out_keeper. allocate_memory (cur_test-> out )) ;
417+ mli_tensor out = { 0 } ;
409418 if (is_test_passed &&
410- (tensor_quantizer::validate_tensor (input) != tensor_quantizer::kOk ||
411- tensor_quantizer::validate_tensor (out) != tensor_quantizer::kOk )) {
419+ tensor_quantizer::validate_tensor (input) != tensor_quantizer::kOk ) {
412420 is_test_passed = false ;
413421 reporter.report_message (cur_test->descr ,
414- " At quantization step: more memory for in or out tensor is be required" );
422+ " At quantization step: more memory for in tensor is required" );
415423 }
416424
417425 if (is_test_passed &&
418- ( mem_in_keeper.is_memory_corrupted () || mem_out_keeper. is_memory_corrupted () )) {
426+ mem_in_keeper.is_memory_corrupted ()) {
419427 is_test_passed = false ;
420428 reporter.report_message (cur_test->descr ,
421429 " At quantization step: memory beside one of operands is corrupted" );
422430 }
423431
424432 // Run specific kernel for test
425-
426433 crc32_calc data_crc_before, data_crc_after;
427- if (is_test_passed &&
428- mli_hlp_create_subtensor (&input, &cur_test->cfg , &out) != MLI_STATUS_OK) {
434+ if (is_test_passed) {
429435 data_crc_before (input);
430- reporter.report_message (cur_test->descr , " FAILED at kernel run: kernel returned bad status" );
431- is_test_passed = false ;
436+ if (mli_hlp_create_subtensor (&input, &cur_test->cfg , &out) != MLI_STATUS_OK) {
437+ is_test_passed = false ;
438+ reporter.report_message (cur_test->descr , " FAILED at kernel run: kernel returned bad status" );
439+ }
432440 data_crc_after (input);
433441 }
434442
435443 if (is_test_passed &&
436- (data_crc_before.get () != data_crc_after.get () ||
444+ (data_crc_before.get () != data_crc_after.get () ||
437445 mem_in_keeper.is_memory_corrupted ())) {
438446 is_test_passed = false ;
439447 reporter.report_message (cur_test->descr ,
440- " At function run: memory is corrupted after functions invokation " );
448+ " At function run: memory is corrupted after functions invocation " );
441449 }
442450
443451 if (is_test_passed &&
444- test_metrics.calculate_metrics (out, cur_test->out ) == false ) {
452+ test_metrics.calculate_metrics (out, cur_test->out ) == false ) {
445453 reporter.report_message (cur_test->descr , " FAILED at comparison output with reference" );
446454 is_test_passed = false ;
447455 }
@@ -451,7 +459,7 @@ bool run_test_create_subtensor() {
451459 data_crc (input);
452460 data_crc (out);
453461 is_test_passed &= reporter.evaluate_and_report_case (cur_test->descr , test_metrics, cur_test->threshold ,
454- data_crc, cur_test->check_sum );
462+ data_crc, cur_test->check_sum );
455463 }
456464 test_status &= is_test_passed;
457465 }
0 commit comments