test_onnx_conformance.cpp 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #include "test_precomp.hpp"
  5. #include <set>
  6. #include <string>
  7. #include "npy_blob.hpp"
  8. #include <opencv2/dnn/shape_utils.hpp>
  9. #if defined(_MSC_VER) // workaround for 32-bit MSVC compiler
  10. #pragma optimize("", off)
  11. #endif
  12. #define CV_TEST_TAG_DNN_ERROR_PARSER "dnn_error_parser"
  13. #define CV_TEST_TAG_DNN_ERROR_NET_SETUP "dnn_error_net_setup"
  14. #define CV_TEST_TAG_DNN_ERROR_FORWARD "dnn_error_forward"
  15. #define CV_TEST_TAG_DNN_LAYER_FALLBACK "dnn_layer_fallback"
  16. #define CV_TEST_TAG_DNN_NO_ACCURACY_CHECK "dnn_no_accuracy_check"
  17. namespace opencv_test {
  18. struct TestCase
  19. {
  20. const char* name;
  21. uint32_t inputs;
  22. uint32_t outputs;
  23. };
  24. static const TestCase testConformanceConfig[] = {
  25. {"test_abs", 1, 1},
  26. {"test_acos", 1, 1},
  27. {"test_acos_example", 1, 1},
  28. {"test_acosh", 1, 1},
  29. {"test_acosh_example", 1, 1},
  30. {"test_adagrad", 5, 2},
  31. {"test_adagrad_multiple", 8, 4},
  32. {"test_adam", 6, 3},
  33. {"test_adam_multiple", 10, 6},
  34. {"test_add", 2, 1},
  35. {"test_add_bcast", 2, 1},
  36. {"test_add_uint8", 2, 1},
  37. {"test_and2d", 2, 1},
  38. {"test_and3d", 2, 1},
  39. {"test_and4d", 2, 1},
  40. {"test_and_bcast3v1d", 2, 1},
  41. {"test_and_bcast3v2d", 2, 1},
  42. {"test_and_bcast4v2d", 2, 1},
  43. {"test_and_bcast4v3d", 2, 1},
  44. {"test_and_bcast4v4d", 2, 1},
  45. {"test_argmax_default_axis_example", 1, 1},
  46. {"test_argmax_default_axis_example_select_last_index", 1, 1},
  47. {"test_argmax_default_axis_random", 1, 1},
  48. {"test_argmax_default_axis_random_select_last_index", 1, 1},
  49. {"test_argmax_keepdims_example", 1, 1},
  50. {"test_argmax_keepdims_example_select_last_index", 1, 1},
  51. {"test_argmax_keepdims_random", 1, 1},
  52. {"test_argmax_keepdims_random_select_last_index", 1, 1},
  53. {"test_argmax_negative_axis_keepdims_example", 1, 1},
  54. {"test_argmax_negative_axis_keepdims_example_select_last_index", 1, 1},
  55. {"test_argmax_negative_axis_keepdims_random", 1, 1},
  56. {"test_argmax_negative_axis_keepdims_random_select_last_index", 1, 1},
  57. {"test_argmax_no_keepdims_example", 1, 1},
  58. {"test_argmax_no_keepdims_example_select_last_index", 1, 1},
  59. {"test_argmax_no_keepdims_random", 1, 1},
  60. {"test_argmax_no_keepdims_random_select_last_index", 1, 1},
  61. {"test_argmin_default_axis_example", 1, 1},
  62. {"test_argmin_default_axis_example_select_last_index", 1, 1},
  63. {"test_argmin_default_axis_random", 1, 1},
  64. {"test_argmin_default_axis_random_select_last_index", 1, 1},
  65. {"test_argmin_keepdims_example", 1, 1},
  66. {"test_argmin_keepdims_example_select_last_index", 1, 1},
  67. {"test_argmin_keepdims_random", 1, 1},
  68. {"test_argmin_keepdims_random_select_last_index", 1, 1},
  69. {"test_argmin_negative_axis_keepdims_example", 1, 1},
  70. {"test_argmin_negative_axis_keepdims_example_select_last_index", 1, 1},
  71. {"test_argmin_negative_axis_keepdims_random", 1, 1},
  72. {"test_argmin_negative_axis_keepdims_random_select_last_index", 1, 1},
  73. {"test_argmin_no_keepdims_example", 1, 1},
  74. {"test_argmin_no_keepdims_example_select_last_index", 1, 1},
  75. {"test_argmin_no_keepdims_random", 1, 1},
  76. {"test_argmin_no_keepdims_random_select_last_index", 1, 1},
  77. {"test_asin", 1, 1},
  78. {"test_asin_example", 1, 1},
  79. {"test_asinh", 1, 1},
  80. {"test_asinh_example", 1, 1},
  81. {"test_atan", 1, 1},
  82. {"test_atan_example", 1, 1},
  83. {"test_atanh", 1, 1},
  84. {"test_atanh_example", 1, 1},
  85. {"test_averagepool_1d_default", 1, 1},
  86. {"test_averagepool_2d_ceil", 1, 1},
  87. {"test_averagepool_2d_default", 1, 1},
  88. {"test_averagepool_2d_pads", 1, 1},
  89. {"test_averagepool_2d_pads_count_include_pad", 1, 1},
  90. {"test_averagepool_2d_precomputed_pads", 1, 1},
  91. {"test_averagepool_2d_precomputed_pads_count_include_pad", 1, 1},
  92. {"test_averagepool_2d_precomputed_same_upper", 1, 1},
  93. {"test_averagepool_2d_precomputed_strides", 1, 1},
  94. {"test_averagepool_2d_same_lower", 1, 1},
  95. {"test_averagepool_2d_same_upper", 1, 1},
  96. {"test_averagepool_2d_strides", 1, 1},
  97. {"test_averagepool_3d_default", 1, 1},
  98. {"test_basic_conv_with_padding", 2, 1},
  99. {"test_basic_conv_without_padding", 2, 1},
  100. {"test_basic_convinteger", 3, 1},
  101. {"test_batchnorm_epsilon", 5, 1},
  102. {"test_batchnorm_epsilon_training_mode", 5, 3},
  103. {"test_batchnorm_example", 5, 1},
  104. {"test_batchnorm_example_training_mode", 5, 3},
  105. {"test_bernoulli", 1, 1},
  106. {"test_bernoulli_double", 1, 1},
  107. {"test_bernoulli_double_expanded", 1, 1},
  108. {"test_bernoulli_expanded", 1, 1},
  109. {"test_bernoulli_seed", 1, 1},
  110. {"test_bernoulli_seed_expanded", 1, 1},
  111. {"test_bitshift_left_uint16", 2, 1},
  112. {"test_bitshift_left_uint32", 2, 1},
  113. {"test_bitshift_left_uint64", 2, 1},
  114. {"test_bitshift_left_uint8", 2, 1},
  115. {"test_bitshift_right_uint16", 2, 1},
  116. {"test_bitshift_right_uint32", 2, 1},
  117. {"test_bitshift_right_uint64", 2, 1},
  118. {"test_bitshift_right_uint8", 2, 1},
  119. {"test_cast_BFLOAT16_to_FLOAT", 1, 1},
  120. {"test_cast_DOUBLE_to_FLOAT", 1, 1},
  121. {"test_cast_DOUBLE_to_FLOAT16", 1, 1},
  122. {"test_cast_FLOAT16_to_DOUBLE", 1, 1},
  123. {"test_cast_FLOAT16_to_FLOAT", 1, 1},
  124. {"test_cast_FLOAT_to_BFLOAT16", 1, 1},
  125. {"test_cast_FLOAT_to_DOUBLE", 1, 1},
  126. {"test_cast_FLOAT_to_FLOAT16", 1, 1},
  127. {"test_cast_FLOAT_to_STRING", 1, 1},
  128. {"test_cast_STRING_to_FLOAT", 1, 1},
  129. {"test_castlike_BFLOAT16_to_FLOAT", 2, 1},
  130. {"test_castlike_BFLOAT16_to_FLOAT_expanded", 2, 1},
  131. {"test_castlike_DOUBLE_to_FLOAT", 2, 1},
  132. {"test_castlike_DOUBLE_to_FLOAT16", 2, 1},
  133. {"test_castlike_DOUBLE_to_FLOAT16_expanded", 2, 1},
  134. {"test_castlike_DOUBLE_to_FLOAT_expanded", 2, 1},
  135. {"test_castlike_FLOAT16_to_DOUBLE", 2, 1},
  136. {"test_castlike_FLOAT16_to_DOUBLE_expanded", 2, 1},
  137. {"test_castlike_FLOAT16_to_FLOAT", 2, 1},
  138. {"test_castlike_FLOAT16_to_FLOAT_expanded", 2, 1},
  139. {"test_castlike_FLOAT_to_BFLOAT16", 2, 1},
  140. {"test_castlike_FLOAT_to_BFLOAT16_expanded", 2, 1},
  141. {"test_castlike_FLOAT_to_DOUBLE", 2, 1},
  142. {"test_castlike_FLOAT_to_DOUBLE_expanded", 2, 1},
  143. {"test_castlike_FLOAT_to_FLOAT16", 2, 1},
  144. {"test_castlike_FLOAT_to_FLOAT16_expanded", 2, 1},
  145. {"test_castlike_FLOAT_to_STRING", 2, 1},
  146. {"test_castlike_FLOAT_to_STRING_expanded", 2, 1},
  147. {"test_castlike_STRING_to_FLOAT", 2, 1},
  148. {"test_castlike_STRING_to_FLOAT_expanded", 2, 1},
  149. {"test_ceil", 1, 1},
  150. {"test_ceil_example", 1, 1},
  151. {"test_celu", 1, 1},
  152. {"test_celu_expanded", 1, 1},
  153. {"test_clip", 3, 1},
  154. {"test_clip_default_inbounds", 1, 1},
  155. {"test_clip_default_int8_inbounds", 1, 1},
  156. {"test_clip_default_int8_max", 2, 1},
  157. {"test_clip_default_int8_min", 2, 1},
  158. {"test_clip_default_max", 2, 1},
  159. {"test_clip_default_min", 2, 1},
  160. {"test_clip_example", 3, 1},
  161. {"test_clip_inbounds", 3, 1},
  162. {"test_clip_outbounds", 3, 1},
  163. {"test_clip_splitbounds", 3, 1},
  164. {"test_compress_0", 2, 1},
  165. {"test_compress_1", 2, 1},
  166. {"test_compress_default_axis", 2, 1},
  167. {"test_compress_negative_axis", 2, 1},
  168. {"test_concat_1d_axis_0", 2, 1},
  169. {"test_concat_1d_axis_negative_1", 2, 1},
  170. {"test_concat_2d_axis_0", 2, 1},
  171. {"test_concat_2d_axis_1", 2, 1},
  172. {"test_concat_2d_axis_negative_1", 2, 1},
  173. {"test_concat_2d_axis_negative_2", 2, 1},
  174. {"test_concat_3d_axis_0", 2, 1},
  175. {"test_concat_3d_axis_1", 2, 1},
  176. {"test_concat_3d_axis_2", 2, 1},
  177. {"test_concat_3d_axis_negative_1", 2, 1},
  178. {"test_concat_3d_axis_negative_2", 2, 1},
  179. {"test_concat_3d_axis_negative_3", 2, 1},
  180. {"test_constant", 0, 1},
  181. {"test_constant_pad", 3, 1},
  182. {"test_constantofshape_float_ones", 1, 1},
  183. {"test_constantofshape_int_shape_zero", 1, 1},
  184. {"test_constantofshape_int_zeros", 1, 1},
  185. {"test_conv_with_autopad_same", 2, 1},
  186. {"test_conv_with_strides_and_asymmetric_padding", 2, 1},
  187. {"test_conv_with_strides_no_padding", 2, 1},
  188. {"test_conv_with_strides_padding", 2, 1},
  189. {"test_convinteger_with_padding", 3, 1},
  190. {"test_convinteger_without_padding", 3, 1},
  191. {"test_convtranspose", 2, 1},
  192. {"test_convtranspose_1d", 2, 1},
  193. {"test_convtranspose_3d", 2, 1},
  194. {"test_convtranspose_autopad_same", 2, 1},
  195. {"test_convtranspose_dilations", 2, 1},
  196. {"test_convtranspose_kernel_shape", 2, 1},
  197. {"test_convtranspose_output_shape", 2, 1},
  198. {"test_convtranspose_pad", 2, 1},
  199. {"test_convtranspose_pads", 2, 1},
  200. {"test_convtranspose_with_kernel", 2, 1},
  201. {"test_cos", 1, 1},
  202. {"test_cos_example", 1, 1},
  203. {"test_cosh", 1, 1},
  204. {"test_cosh_example", 1, 1},
  205. {"test_cumsum_1d", 2, 1},
  206. {"test_cumsum_1d_exclusive", 2, 1},
  207. {"test_cumsum_1d_reverse", 2, 1},
  208. {"test_cumsum_1d_reverse_exclusive", 2, 1},
  209. {"test_cumsum_2d_axis_0", 2, 1},
  210. {"test_cumsum_2d_axis_1", 2, 1},
  211. {"test_cumsum_2d_negative_axis", 2, 1},
  212. {"test_depthtospace_crd_mode", 1, 1},
  213. {"test_depthtospace_crd_mode_example", 1, 1},
  214. {"test_depthtospace_dcr_mode", 1, 1},
  215. {"test_depthtospace_example", 1, 1},
  216. {"test_dequantizelinear", 3, 1},
  217. {"test_dequantizelinear_axis", 3, 1},
  218. {"test_det_2d", 1, 1},
  219. {"test_det_nd", 1, 1},
  220. {"test_div", 2, 1},
  221. {"test_div_bcast", 2, 1},
  222. {"test_div_example", 2, 1},
  223. {"test_div_uint8", 2, 1},
  224. {"test_dropout_default", 1, 1},
  225. {"test_dropout_default_mask", 1, 2},
  226. {"test_dropout_default_mask_ratio", 2, 2},
  227. {"test_dropout_default_old", 1, 1},
  228. {"test_dropout_default_ratio", 2, 1},
  229. {"test_dropout_random_old", 1, 1},
  230. {"test_dynamicquantizelinear", 1, 3},
  231. {"test_dynamicquantizelinear_expanded", 1, 3},
  232. {"test_dynamicquantizelinear_max_adjusted", 1, 3},
  233. {"test_dynamicquantizelinear_max_adjusted_expanded", 1, 3},
  234. {"test_dynamicquantizelinear_min_adjusted", 1, 3},
  235. {"test_dynamicquantizelinear_min_adjusted_expanded", 1, 3},
  236. {"test_edge_pad", 2, 1},
  237. {"test_einsum_batch_diagonal", 1, 1},
  238. {"test_einsum_batch_matmul", 2, 1},
  239. {"test_einsum_inner_prod", 2, 1},
  240. {"test_einsum_sum", 1, 1},
  241. {"test_einsum_transpose", 1, 1},
  242. {"test_elu", 1, 1},
  243. {"test_elu_default", 1, 1},
  244. {"test_elu_example", 1, 1},
  245. {"test_equal", 2, 1},
  246. {"test_equal_bcast", 2, 1},
  247. {"test_erf", 1, 1},
  248. {"test_exp", 1, 1},
  249. {"test_exp_example", 1, 1},
  250. {"test_expand_dim_changed", 2, 1},
  251. {"test_expand_dim_unchanged", 2, 1},
  252. {"test_eyelike_populate_off_main_diagonal", 1, 1},
  253. {"test_eyelike_with_dtype", 1, 1},
  254. {"test_eyelike_without_dtype", 1, 1},
  255. {"test_flatten_axis0", 1, 1},
  256. {"test_flatten_axis1", 1, 1},
  257. {"test_flatten_axis2", 1, 1},
  258. {"test_flatten_axis3", 1, 1},
  259. {"test_flatten_default_axis", 1, 1},
  260. {"test_flatten_negative_axis1", 1, 1},
  261. {"test_flatten_negative_axis2", 1, 1},
  262. {"test_flatten_negative_axis3", 1, 1},
  263. {"test_flatten_negative_axis4", 1, 1},
  264. {"test_floor", 1, 1},
  265. {"test_floor_example", 1, 1},
  266. {"test_gather_0", 2, 1},
  267. {"test_gather_1", 2, 1},
  268. {"test_gather_2d_indices", 2, 1},
  269. {"test_gather_elements_0", 2, 1},
  270. {"test_gather_elements_1", 2, 1},
  271. {"test_gather_elements_negative_indices", 2, 1},
  272. {"test_gather_negative_indices", 2, 1},
  273. {"test_gathernd_example_float32", 2, 1},
  274. {"test_gathernd_example_int32", 2, 1},
  275. {"test_gathernd_example_int32_batch_dim1", 2, 1},
  276. {"test_gemm_all_attributes", 3, 1},
  277. {"test_gemm_alpha", 3, 1},
  278. {"test_gemm_beta", 3, 1},
  279. {"test_gemm_default_matrix_bias", 3, 1},
  280. {"test_gemm_default_no_bias", 2, 1},
  281. {"test_gemm_default_scalar_bias", 3, 1},
  282. {"test_gemm_default_single_elem_vector_bias", 3, 1},
  283. {"test_gemm_default_vector_bias", 3, 1},
  284. {"test_gemm_default_zero_bias", 3, 1},
  285. {"test_gemm_transposeA", 3, 1},
  286. {"test_gemm_transposeB", 3, 1},
  287. {"test_globalaveragepool", 1, 1},
  288. {"test_globalaveragepool_precomputed", 1, 1},
  289. {"test_globalmaxpool", 1, 1},
  290. {"test_globalmaxpool_precomputed", 1, 1},
  291. {"test_greater", 2, 1},
  292. {"test_greater_bcast", 2, 1},
  293. {"test_greater_equal", 2, 1},
  294. {"test_greater_equal_bcast", 2, 1},
  295. {"test_greater_equal_bcast_expanded", 2, 1},
  296. {"test_greater_equal_expanded", 2, 1},
  297. {"test_gridsample", 2, 1},
  298. {"test_gridsample_aligncorners_true", 2, 1},
  299. {"test_gridsample_bicubic", 2, 1},
  300. {"test_gridsample_bilinear", 2, 1},
  301. {"test_gridsample_border_padding", 2, 1},
  302. {"test_gridsample_nearest", 2, 1},
  303. {"test_gridsample_reflection_padding", 2, 1},
  304. {"test_gridsample_zeros_padding", 2, 1},
  305. {"test_gru_batchwise", 3, 2},
  306. {"test_gru_defaults", 3, 1},
  307. {"test_gru_seq_length", 4, 1},
  308. {"test_gru_with_initial_bias", 4, 1},
  309. {"test_hardmax_axis_0", 1, 1},
  310. {"test_hardmax_axis_1", 1, 1},
  311. {"test_hardmax_axis_2", 1, 1},
  312. {"test_hardmax_default_axis", 1, 1},
  313. {"test_hardmax_example", 1, 1},
  314. {"test_hardmax_negative_axis", 1, 1},
  315. {"test_hardmax_one_hot", 1, 1},
  316. {"test_hardsigmoid", 1, 1},
  317. {"test_hardsigmoid_default", 1, 1},
  318. {"test_hardsigmoid_example", 1, 1},
  319. {"test_hardswish", 1, 1},
  320. {"test_hardswish_expanded", 1, 1},
  321. {"test_identity", 1, 1},
  322. {"test_identity_opt", 1, 1},
  323. {"test_identity_sequence", 1, 1},
  324. {"test_if", 1, 1},
  325. {"test_if_opt", 1, 1},
  326. {"test_if_seq", 1, 1},
  327. {"test_instancenorm_epsilon", 3, 1},
  328. {"test_instancenorm_example", 3, 1},
  329. {"test_isinf", 1, 1},
  330. {"test_isinf_negative", 1, 1},
  331. {"test_isinf_positive", 1, 1},
  332. {"test_isnan", 1, 1},
  333. {"test_leakyrelu", 1, 1},
  334. {"test_leakyrelu_default", 1, 1},
  335. {"test_leakyrelu_example", 1, 1},
  336. {"test_less", 2, 1},
  337. {"test_less_bcast", 2, 1},
  338. {"test_less_equal", 2, 1},
  339. {"test_less_equal_bcast", 2, 1},
  340. {"test_less_equal_bcast_expanded", 2, 1},
  341. {"test_less_equal_expanded", 2, 1},
  342. {"test_log", 1, 1},
  343. {"test_log_example", 1, 1},
  344. {"test_logsoftmax_axis_0", 1, 1},
  345. {"test_logsoftmax_axis_0_expanded", 1, 1},
  346. {"test_logsoftmax_axis_1", 1, 1},
  347. {"test_logsoftmax_axis_1_expanded", 1, 1},
  348. {"test_logsoftmax_axis_2", 1, 1},
  349. {"test_logsoftmax_axis_2_expanded", 1, 1},
  350. {"test_logsoftmax_default_axis", 1, 1},
  351. {"test_logsoftmax_default_axis_expanded", 1, 1},
  352. {"test_logsoftmax_example_1", 1, 1},
  353. {"test_logsoftmax_example_1_expanded", 1, 1},
  354. {"test_logsoftmax_large_number", 1, 1},
  355. {"test_logsoftmax_large_number_expanded", 1, 1},
  356. {"test_logsoftmax_negative_axis", 1, 1},
  357. {"test_logsoftmax_negative_axis_expanded", 1, 1},
  358. {"test_loop11", 3, 2},
  359. {"test_loop13_seq", 3, 1},
  360. {"test_loop16_seq_none", 3, 1},
  361. {"test_lrn", 1, 1},
  362. {"test_lrn_default", 1, 1},
  363. {"test_lstm_batchwise", 3, 2},
  364. {"test_lstm_defaults", 3, 1},
  365. {"test_lstm_with_initial_bias", 4, 1},
  366. {"test_lstm_with_peepholes", 8, 1},
  367. {"test_matmul_2d", 2, 1},
  368. {"test_matmul_3d", 2, 1},
  369. {"test_matmul_4d", 2, 1},
  370. {"test_matmulinteger", 4, 1},
  371. {"test_max_example", 3, 1},
  372. {"test_max_float16", 2, 1},
  373. {"test_max_float32", 2, 1},
  374. {"test_max_float64", 2, 1},
  375. {"test_max_int16", 2, 1},
  376. {"test_max_int32", 2, 1},
  377. {"test_max_int64", 2, 1},
  378. {"test_max_int8", 2, 1},
  379. {"test_max_one_input", 1, 1},
  380. {"test_max_two_inputs", 2, 1},
  381. {"test_max_uint16", 2, 1},
  382. {"test_max_uint32", 2, 1},
  383. {"test_max_uint64", 2, 1},
  384. {"test_max_uint8", 2, 1},
  385. {"test_maxpool_1d_default", 1, 1},
  386. {"test_maxpool_2d_ceil", 1, 1},
  387. {"test_maxpool_2d_default", 1, 1},
  388. {"test_maxpool_2d_dilations", 1, 1},
  389. {"test_maxpool_2d_pads", 1, 1},
  390. {"test_maxpool_2d_precomputed_pads", 1, 1},
  391. {"test_maxpool_2d_precomputed_same_upper", 1, 1},
  392. {"test_maxpool_2d_precomputed_strides", 1, 1},
  393. {"test_maxpool_2d_same_lower", 1, 1},
  394. {"test_maxpool_2d_same_upper", 1, 1},
  395. {"test_maxpool_2d_strides", 1, 1},
  396. {"test_maxpool_2d_uint8", 1, 1},
  397. {"test_maxpool_3d_default", 1, 1},
  398. {"test_maxpool_with_argmax_2d_precomputed_pads", 1, 2},
  399. {"test_maxpool_with_argmax_2d_precomputed_strides", 1, 2},
  400. {"test_maxunpool_export_with_output_shape", 3, 1},
  401. {"test_maxunpool_export_without_output_shape", 2, 1},
  402. {"test_mean_example", 3, 1},
  403. {"test_mean_one_input", 1, 1},
  404. {"test_mean_two_inputs", 2, 1},
  405. {"test_min_example", 3, 1},
  406. {"test_min_float16", 2, 1},
  407. {"test_min_float32", 2, 1},
  408. {"test_min_float64", 2, 1},
  409. {"test_min_int16", 2, 1},
  410. {"test_min_int32", 2, 1},
  411. {"test_min_int64", 2, 1},
  412. {"test_min_int8", 2, 1},
  413. {"test_min_one_input", 1, 1},
  414. {"test_min_two_inputs", 2, 1},
  415. {"test_min_uint16", 2, 1},
  416. {"test_min_uint32", 2, 1},
  417. {"test_min_uint64", 2, 1},
  418. {"test_min_uint8", 2, 1},
  419. {"test_mod_broadcast", 2, 1},
  420. {"test_mod_int64_fmod", 2, 1},
  421. {"test_mod_mixed_sign_float16", 2, 1},
  422. {"test_mod_mixed_sign_float32", 2, 1},
  423. {"test_mod_mixed_sign_float64", 2, 1},
  424. {"test_mod_mixed_sign_int16", 2, 1},
  425. {"test_mod_mixed_sign_int32", 2, 1},
  426. {"test_mod_mixed_sign_int64", 2, 1},
  427. {"test_mod_mixed_sign_int8", 2, 1},
  428. {"test_mod_uint16", 2, 1},
  429. {"test_mod_uint32", 2, 1},
  430. {"test_mod_uint64", 2, 1},
  431. {"test_mod_uint8", 2, 1},
  432. {"test_momentum", 5, 2},
  433. {"test_momentum_multiple", 8, 4},
  434. {"test_mul", 2, 1},
  435. {"test_mul_bcast", 2, 1},
  436. {"test_mul_example", 2, 1},
  437. {"test_mul_uint8", 2, 1},
  438. {"test_mvn", 1, 1},
  439. {"test_mvn_expanded", 1, 1},
  440. {"test_neg", 1, 1},
  441. {"test_neg_example", 1, 1},
  442. {"test_nesterov_momentum", 5, 2},
  443. {"test_nllloss_NC", 2, 1},
  444. {"test_nllloss_NC_expanded", 2, 1},
  445. {"test_nllloss_NCd1", 2, 1},
  446. {"test_nllloss_NCd1_expanded", 2, 1},
  447. {"test_nllloss_NCd1_ii", 2, 1},
  448. {"test_nllloss_NCd1_ii_expanded", 2, 1},
  449. {"test_nllloss_NCd1_mean_weight_negative_ii", 3, 1},
  450. {"test_nllloss_NCd1_mean_weight_negative_ii_expanded", 3, 1},
  451. {"test_nllloss_NCd1_weight", 3, 1},
  452. {"test_nllloss_NCd1_weight_expanded", 3, 1},
  453. {"test_nllloss_NCd1_weight_ii", 3, 1},
  454. {"test_nllloss_NCd1_weight_ii_expanded", 3, 1},
  455. {"test_nllloss_NCd1d2", 2, 1},
  456. {"test_nllloss_NCd1d2_expanded", 2, 1},
  457. {"test_nllloss_NCd1d2_no_weight_reduction_mean_ii", 2, 1},
  458. {"test_nllloss_NCd1d2_no_weight_reduction_mean_ii_expanded", 2, 1},
  459. {"test_nllloss_NCd1d2_reduction_mean", 2, 1},
  460. {"test_nllloss_NCd1d2_reduction_mean_expanded", 2, 1},
  461. {"test_nllloss_NCd1d2_reduction_sum", 2, 1},
  462. {"test_nllloss_NCd1d2_reduction_sum_expanded", 2, 1},
  463. {"test_nllloss_NCd1d2_with_weight", 3, 1},
  464. {"test_nllloss_NCd1d2_with_weight_expanded", 3, 1},
  465. {"test_nllloss_NCd1d2_with_weight_reduction_mean", 3, 1},
  466. {"test_nllloss_NCd1d2_with_weight_reduction_mean_expanded", 3, 1},
  467. {"test_nllloss_NCd1d2_with_weight_reduction_sum", 3, 1},
  468. {"test_nllloss_NCd1d2_with_weight_reduction_sum_expanded", 3, 1},
  469. {"test_nllloss_NCd1d2_with_weight_reduction_sum_ii", 3, 1},
  470. {"test_nllloss_NCd1d2_with_weight_reduction_sum_ii_expanded", 3, 1},
  471. {"test_nllloss_NCd1d2d3_none_no_weight_negative_ii", 2, 1},
  472. {"test_nllloss_NCd1d2d3_none_no_weight_negative_ii_expanded", 2, 1},
  473. {"test_nllloss_NCd1d2d3_sum_weight_high_ii", 3, 1},
  474. {"test_nllloss_NCd1d2d3_sum_weight_high_ii_expanded", 3, 1},
  475. {"test_nllloss_NCd1d2d3d4d5_mean_weight", 3, 1},
  476. {"test_nllloss_NCd1d2d3d4d5_mean_weight_expanded", 3, 1},
  477. {"test_nllloss_NCd1d2d3d4d5_none_no_weight", 2, 1},
  478. {"test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded", 2, 1},
  479. {"test_nonmaxsuppression_center_point_box_format", 5, 1},
  480. {"test_nonmaxsuppression_flipped_coordinates", 5, 1},
  481. {"test_nonmaxsuppression_identical_boxes", 5, 1},
  482. {"test_nonmaxsuppression_limit_output_size", 5, 1},
  483. {"test_nonmaxsuppression_single_box", 5, 1},
  484. {"test_nonmaxsuppression_suppress_by_IOU", 5, 1},
  485. {"test_nonmaxsuppression_suppress_by_IOU_and_scores", 5, 1},
  486. {"test_nonmaxsuppression_two_batches", 5, 1},
  487. {"test_nonmaxsuppression_two_classes", 5, 1},
  488. {"test_nonzero_example", 1, 1},
  489. {"test_not_2d", 1, 1},
  490. {"test_not_3d", 1, 1},
  491. {"test_not_4d", 1, 1},
  492. {"test_onehot_negative_indices", 3, 1},
  493. {"test_onehot_with_axis", 3, 1},
  494. {"test_onehot_with_negative_axis", 3, 1},
  495. {"test_onehot_without_axis", 3, 1},
  496. {"test_optional_get_element", 1, 1},
  497. {"test_optional_get_element_sequence", 1, 1},
  498. {"test_optional_has_element", 1, 1},
  499. {"test_optional_has_element_empty", 1, 1},
  500. {"test_or2d", 2, 1},
  501. {"test_or3d", 2, 1},
  502. {"test_or4d", 2, 1},
  503. {"test_or_bcast3v1d", 2, 1},
  504. {"test_or_bcast3v2d", 2, 1},
  505. {"test_or_bcast4v2d", 2, 1},
  506. {"test_or_bcast4v3d", 2, 1},
  507. {"test_or_bcast4v4d", 2, 1},
  508. {"test_pow", 2, 1},
  509. {"test_pow_bcast_array", 2, 1},
  510. {"test_pow_bcast_scalar", 2, 1},
  511. {"test_pow_example", 2, 1},
  512. {"test_pow_types_float", 2, 1},
  513. {"test_pow_types_float32_int32", 2, 1},
  514. {"test_pow_types_float32_int64", 2, 1},
  515. {"test_pow_types_float32_uint32", 2, 1},
  516. {"test_pow_types_float32_uint64", 2, 1},
  517. {"test_pow_types_int", 2, 1},
  518. {"test_pow_types_int32_float32", 2, 1},
  519. {"test_pow_types_int32_int32", 2, 1},
  520. {"test_pow_types_int64_float32", 2, 1},
  521. {"test_pow_types_int64_int64", 2, 1},
  522. {"test_prelu_broadcast", 2, 1},
  523. {"test_prelu_example", 2, 1},
  524. {"test_qlinearconv", 8, 1},
  525. {"test_qlinearmatmul_2D", 8, 1},
  526. {"test_qlinearmatmul_3D", 8, 1},
  527. {"test_quantizelinear", 3, 1},
  528. {"test_quantizelinear_axis", 3, 1},
  529. {"test_range_float_type_positive_delta", 3, 1},
  530. {"test_range_float_type_positive_delta_expanded", 3, 1},
  531. {"test_range_int32_type_negative_delta", 3, 1},
  532. {"test_range_int32_type_negative_delta_expanded", 3, 1},
  533. {"test_reciprocal", 1, 1},
  534. {"test_reciprocal_example", 1, 1},
  535. {"test_reduce_l1_default_axes_keepdims_example", 1, 1},
  536. {"test_reduce_l1_default_axes_keepdims_random", 1, 1},
  537. {"test_reduce_l1_do_not_keepdims_example", 1, 1},
  538. {"test_reduce_l1_do_not_keepdims_random", 1, 1},
  539. {"test_reduce_l1_keep_dims_example", 1, 1},
  540. {"test_reduce_l1_keep_dims_random", 1, 1},
  541. {"test_reduce_l1_negative_axes_keep_dims_example", 1, 1},
  542. {"test_reduce_l1_negative_axes_keep_dims_random", 1, 1},
  543. {"test_reduce_l2_default_axes_keepdims_example", 1, 1},
  544. {"test_reduce_l2_default_axes_keepdims_random", 1, 1},
  545. {"test_reduce_l2_do_not_keepdims_example", 1, 1},
  546. {"test_reduce_l2_do_not_keepdims_random", 1, 1},
  547. {"test_reduce_l2_keep_dims_example", 1, 1},
  548. {"test_reduce_l2_keep_dims_random", 1, 1},
  549. {"test_reduce_l2_negative_axes_keep_dims_example", 1, 1},
  550. {"test_reduce_l2_negative_axes_keep_dims_random", 1, 1},
  551. {"test_reduce_log_sum", 1, 1},
  552. {"test_reduce_log_sum_asc_axes", 1, 1},
  553. {"test_reduce_log_sum_default", 1, 1},
  554. {"test_reduce_log_sum_desc_axes", 1, 1},
  555. {"test_reduce_log_sum_exp_default_axes_keepdims_example", 1, 1},
  556. {"test_reduce_log_sum_exp_default_axes_keepdims_random", 1, 1},
  557. {"test_reduce_log_sum_exp_do_not_keepdims_example", 1, 1},
  558. {"test_reduce_log_sum_exp_do_not_keepdims_random", 1, 1},
  559. {"test_reduce_log_sum_exp_keepdims_example", 1, 1},
  560. {"test_reduce_log_sum_exp_keepdims_random", 1, 1},
  561. {"test_reduce_log_sum_exp_negative_axes_keepdims_example", 1, 1},
  562. {"test_reduce_log_sum_exp_negative_axes_keepdims_random", 1, 1},
  563. {"test_reduce_log_sum_negative_axes", 1, 1},
  564. {"test_reduce_max_default_axes_keepdim_example", 1, 1},
  565. {"test_reduce_max_default_axes_keepdims_random", 1, 1},
  566. {"test_reduce_max_do_not_keepdims_example", 1, 1},
  567. {"test_reduce_max_do_not_keepdims_random", 1, 1},
  568. {"test_reduce_max_keepdims_example", 1, 1},
  569. {"test_reduce_max_keepdims_random", 1, 1},
  570. {"test_reduce_max_negative_axes_keepdims_example", 1, 1},
  571. {"test_reduce_max_negative_axes_keepdims_random", 1, 1},
  572. {"test_reduce_mean_default_axes_keepdims_example", 1, 1},
  573. {"test_reduce_mean_default_axes_keepdims_random", 1, 1},
  574. {"test_reduce_mean_do_not_keepdims_example", 1, 1},
  575. {"test_reduce_mean_do_not_keepdims_random", 1, 1},
  576. {"test_reduce_mean_keepdims_example", 1, 1},
  577. {"test_reduce_mean_keepdims_random", 1, 1},
  578. {"test_reduce_mean_negative_axes_keepdims_example", 1, 1},
  579. {"test_reduce_mean_negative_axes_keepdims_random", 1, 1},
  580. {"test_reduce_min_default_axes_keepdims_example", 1, 1},
  581. {"test_reduce_min_default_axes_keepdims_random", 1, 1},
  582. {"test_reduce_min_do_not_keepdims_example", 1, 1},
  583. {"test_reduce_min_do_not_keepdims_random", 1, 1},
  584. {"test_reduce_min_keepdims_example", 1, 1},
  585. {"test_reduce_min_keepdims_random", 1, 1},
  586. {"test_reduce_min_negative_axes_keepdims_example", 1, 1},
  587. {"test_reduce_min_negative_axes_keepdims_random", 1, 1},
  588. {"test_reduce_prod_default_axes_keepdims_example", 1, 1},
  589. {"test_reduce_prod_default_axes_keepdims_random", 1, 1},
  590. {"test_reduce_prod_do_not_keepdims_example", 1, 1},
  591. {"test_reduce_prod_do_not_keepdims_random", 1, 1},
  592. {"test_reduce_prod_keepdims_example", 1, 1},
  593. {"test_reduce_prod_keepdims_random", 1, 1},
  594. {"test_reduce_prod_negative_axes_keepdims_example", 1, 1},
  595. {"test_reduce_prod_negative_axes_keepdims_random", 1, 1},
  596. {"test_reduce_sum_default_axes_keepdims_example", 2, 1},
  597. {"test_reduce_sum_default_axes_keepdims_random", 2, 1},
  598. {"test_reduce_sum_do_not_keepdims_example", 2, 1},
  599. {"test_reduce_sum_do_not_keepdims_random", 2, 1},
  600. {"test_reduce_sum_empty_axes_input_noop_example", 2, 1},
  601. {"test_reduce_sum_empty_axes_input_noop_random", 2, 1},
  602. {"test_reduce_sum_keepdims_example", 2, 1},
  603. {"test_reduce_sum_keepdims_random", 2, 1},
  604. {"test_reduce_sum_negative_axes_keepdims_example", 2, 1},
  605. {"test_reduce_sum_negative_axes_keepdims_random", 2, 1},
  606. {"test_reduce_sum_square_default_axes_keepdims_example", 1, 1},
  607. {"test_reduce_sum_square_default_axes_keepdims_random", 1, 1},
  608. {"test_reduce_sum_square_do_not_keepdims_example", 1, 1},
  609. {"test_reduce_sum_square_do_not_keepdims_random", 1, 1},
  610. {"test_reduce_sum_square_keepdims_example", 1, 1},
  611. {"test_reduce_sum_square_keepdims_random", 1, 1},
  612. {"test_reduce_sum_square_negative_axes_keepdims_example", 1, 1},
  613. {"test_reduce_sum_square_negative_axes_keepdims_random", 1, 1},
  614. {"test_reflect_pad", 2, 1},
  615. {"test_relu", 1, 1},
  616. {"test_reshape_allowzero_reordered", 2, 1},
  617. {"test_reshape_extended_dims", 2, 1},
  618. {"test_reshape_negative_dim", 2, 1},
  619. {"test_reshape_negative_extended_dims", 2, 1},
  620. {"test_reshape_one_dim", 2, 1},
  621. {"test_reshape_reduced_dims", 2, 1},
  622. {"test_reshape_reordered_all_dims", 2, 1},
  623. {"test_reshape_reordered_last_dims", 2, 1},
  624. {"test_reshape_zero_and_negative_dim", 2, 1},
  625. {"test_reshape_zero_dim", 2, 1},
  626. {"test_resize_downsample_scales_cubic", 2, 1},
  627. {"test_resize_downsample_scales_cubic_A_n0p5_exclude_outside", 2, 1},
  628. {"test_resize_downsample_scales_cubic_align_corners", 2, 1},
  629. {"test_resize_downsample_scales_linear", 2, 1},
  630. {"test_resize_downsample_scales_linear_align_corners", 2, 1},
  631. {"test_resize_downsample_scales_nearest", 2, 1},
  632. {"test_resize_downsample_sizes_cubic", 2, 1},
  633. {"test_resize_downsample_sizes_linear_pytorch_half_pixel", 2, 1},
  634. {"test_resize_downsample_sizes_nearest", 2, 1},
  635. {"test_resize_downsample_sizes_nearest_tf_half_pixel_for_nn", 2, 1},
  636. {"test_resize_tf_crop_and_resize", 3, 1},
  637. {"test_resize_upsample_scales_cubic", 2, 1},
  638. {"test_resize_upsample_scales_cubic_A_n0p5_exclude_outside", 2, 1},
  639. {"test_resize_upsample_scales_cubic_align_corners", 2, 1},
  640. {"test_resize_upsample_scales_cubic_asymmetric", 2, 1},
  641. {"test_resize_upsample_scales_linear", 2, 1},
  642. {"test_resize_upsample_scales_linear_align_corners", 2, 1},
  643. {"test_resize_upsample_scales_nearest", 2, 1},
  644. {"test_resize_upsample_sizes_cubic", 2, 1},
  645. {"test_resize_upsample_sizes_nearest", 2, 1},
  646. {"test_resize_upsample_sizes_nearest_ceil_half_pixel", 2, 1},
  647. {"test_resize_upsample_sizes_nearest_floor_align_corners", 2, 1},
  648. {"test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric", 2, 1},
  649. {"test_reversesequence_batch", 2, 1},
  650. {"test_reversesequence_time", 2, 1},
  651. {"test_rnn_seq_length", 4, 1},
  652. {"test_roialign_aligned_false", 3, 1},
  653. {"test_roialign_aligned_true", 3, 1},
  654. {"test_round", 1, 1},
  655. {"test_scan9_sum", 2, 2},
  656. {"test_scan_sum", 2, 2},
  657. {"test_scatter_elements_with_axis", 3, 1},
  658. {"test_scatter_elements_with_duplicate_indices", 3, 1},
  659. {"test_scatter_elements_with_negative_indices", 3, 1},
  660. {"test_scatter_elements_without_axis", 3, 1},
  661. {"test_scatter_with_axis", 3, 1},
  662. {"test_scatter_without_axis", 3, 1},
  663. {"test_scatternd", 3, 1},
  664. {"test_scatternd_add", 3, 1},
  665. {"test_scatternd_multiply", 3, 1},
  666. {"test_sce_NCd1_mean_weight_negative_ii", 3, 1},
  667. {"test_sce_NCd1_mean_weight_negative_ii_expanded", 3, 1},
  668. {"test_sce_NCd1_mean_weight_negative_ii_log_prob", 3, 2},
  669. {"test_sce_NCd1_mean_weight_negative_ii_log_prob_expanded", 3, 2},
  670. {"test_sce_NCd1d2d3_none_no_weight_negative_ii", 2, 1},
  671. {"test_sce_NCd1d2d3_none_no_weight_negative_ii_expanded", 2, 1},
  672. {"test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob", 2, 2},
  673. {"test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob_expanded", 2, 2},
  674. {"test_sce_NCd1d2d3_sum_weight_high_ii", 3, 1},
  675. {"test_sce_NCd1d2d3_sum_weight_high_ii_expanded", 3, 1},
  676. {"test_sce_NCd1d2d3_sum_weight_high_ii_log_prob", 3, 2},
  677. {"test_sce_NCd1d2d3_sum_weight_high_ii_log_prob_expanded", 3, 2},
  678. {"test_sce_NCd1d2d3d4d5_mean_weight", 3, 1},
  679. {"test_sce_NCd1d2d3d4d5_mean_weight_expanded", 3, 1},
  680. {"test_sce_NCd1d2d3d4d5_mean_weight_log_prob", 3, 2},
  681. {"test_sce_NCd1d2d3d4d5_mean_weight_log_prob_expanded", 3, 2},
  682. {"test_sce_NCd1d2d3d4d5_none_no_weight", 2, 1},
  683. {"test_sce_NCd1d2d3d4d5_none_no_weight_expanded", 2, 1},
  684. {"test_sce_NCd1d2d3d4d5_none_no_weight_log_prob", 2, 2},
  685. {"test_sce_NCd1d2d3d4d5_none_no_weight_log_prob_expanded", 2, 2},
  686. {"test_sce_mean", 2, 1},
  687. {"test_sce_mean_3d", 2, 1},
  688. {"test_sce_mean_3d_expanded", 2, 1},
  689. {"test_sce_mean_3d_log_prob", 2, 2},
  690. {"test_sce_mean_3d_log_prob_expanded", 2, 2},
  691. {"test_sce_mean_expanded", 2, 1},
  692. {"test_sce_mean_log_prob", 2, 2},
  693. {"test_sce_mean_log_prob_expanded", 2, 2},
  694. {"test_sce_mean_no_weight_ii", 2, 1},
  695. {"test_sce_mean_no_weight_ii_3d", 2, 1},
  696. {"test_sce_mean_no_weight_ii_3d_expanded", 2, 1},
  697. {"test_sce_mean_no_weight_ii_3d_log_prob", 2, 2},
  698. {"test_sce_mean_no_weight_ii_3d_log_prob_expanded", 2, 2},
  699. {"test_sce_mean_no_weight_ii_4d", 2, 1},
  700. {"test_sce_mean_no_weight_ii_4d_expanded", 2, 1},
  701. {"test_sce_mean_no_weight_ii_4d_log_prob", 2, 2},
  702. {"test_sce_mean_no_weight_ii_4d_log_prob_expanded", 2, 2},
  703. {"test_sce_mean_no_weight_ii_expanded", 2, 1},
  704. {"test_sce_mean_no_weight_ii_log_prob", 2, 2},
  705. {"test_sce_mean_no_weight_ii_log_prob_expanded", 2, 2},
  706. {"test_sce_mean_weight", 3, 1},
  707. {"test_sce_mean_weight_expanded", 3, 1},
  708. {"test_sce_mean_weight_ii", 3, 1},
  709. {"test_sce_mean_weight_ii_3d", 3, 1},
  710. {"test_sce_mean_weight_ii_3d_expanded", 3, 1},
  711. {"test_sce_mean_weight_ii_3d_log_prob", 3, 2},
  712. {"test_sce_mean_weight_ii_3d_log_prob_expanded", 3, 2},
  713. {"test_sce_mean_weight_ii_4d", 3, 1},
  714. {"test_sce_mean_weight_ii_4d_expanded", 3, 1},
  715. {"test_sce_mean_weight_ii_4d_log_prob", 3, 2},
  716. {"test_sce_mean_weight_ii_4d_log_prob_expanded", 3, 2},
  717. {"test_sce_mean_weight_ii_expanded", 3, 1},
  718. {"test_sce_mean_weight_ii_log_prob", 3, 2},
  719. {"test_sce_mean_weight_ii_log_prob_expanded", 3, 2},
  720. {"test_sce_mean_weight_log_prob", 3, 2},
  721. {"test_sce_mean_weight_log_prob_expanded", 3, 2},
  722. {"test_sce_none", 2, 1},
  723. {"test_sce_none_expanded", 2, 1},
  724. {"test_sce_none_log_prob", 2, 2},
  725. {"test_sce_none_log_prob_expanded", 2, 2},
  726. {"test_sce_none_weights", 3, 1},
  727. {"test_sce_none_weights_expanded", 3, 1},
  728. {"test_sce_none_weights_log_prob", 3, 2},
  729. {"test_sce_none_weights_log_prob_expanded", 3, 2},
  730. {"test_sce_sum", 2, 1},
  731. {"test_sce_sum_expanded", 2, 1},
  732. {"test_sce_sum_log_prob", 2, 2},
  733. {"test_sce_sum_log_prob_expanded", 2, 2},
  734. {"test_selu", 1, 1},
  735. {"test_selu_default", 1, 1},
  736. {"test_selu_example", 1, 1},
  737. {"test_sequence_insert_at_back", 2, 1},
  738. {"test_sequence_insert_at_front", 3, 1},
  739. {"test_shape", 1, 1},
  740. {"test_shape_clip_end", 1, 1},
  741. {"test_shape_clip_start", 1, 1},
  742. {"test_shape_end_1", 1, 1},
  743. {"test_shape_end_negative_1", 1, 1},
  744. {"test_shape_example", 1, 1},
  745. {"test_shape_start_1", 1, 1},
  746. {"test_shape_start_1_end_2", 1, 1},
  747. {"test_shape_start_1_end_negative_1", 1, 1},
  748. {"test_shape_start_negative_1", 1, 1},
  749. {"test_shrink_hard", 1, 1},
  750. {"test_shrink_soft", 1, 1},
  751. {"test_sigmoid", 1, 1},
  752. {"test_sigmoid_example", 1, 1},
  753. {"test_sign", 1, 1},
  754. {"test_simple_rnn_batchwise", 3, 2},
  755. {"test_simple_rnn_defaults", 3, 1},
  756. {"test_simple_rnn_with_initial_bias", 4, 1},
  757. {"test_sin", 1, 1},
  758. {"test_sin_example", 1, 1},
  759. {"test_sinh", 1, 1},
  760. {"test_sinh_example", 1, 1},
  761. {"test_size", 1, 1},
  762. {"test_size_example", 1, 1},
  763. {"test_slice", 5, 1},
  764. {"test_slice_default_axes", 3, 1},
  765. {"test_slice_default_steps", 4, 1},
  766. {"test_slice_end_out_of_bounds", 5, 1},
  767. {"test_slice_neg", 5, 1},
  768. {"test_slice_neg_steps", 5, 1},
  769. {"test_slice_negative_axes", 4, 1},
  770. {"test_slice_start_out_of_bounds", 5, 1},
  771. {"test_softmax_axis_0", 1, 1},
  772. {"test_softmax_axis_0_expanded", 1, 1},
  773. {"test_softmax_axis_1", 1, 1},
  774. {"test_softmax_axis_1_expanded", 1, 1},
  775. {"test_softmax_axis_2", 1, 1},
  776. {"test_softmax_axis_2_expanded", 1, 1},
  777. {"test_softmax_default_axis", 1, 1},
  778. {"test_softmax_default_axis_expanded", 1, 1},
  779. {"test_softmax_example", 1, 1},
  780. {"test_softmax_example_expanded", 1, 1},
  781. {"test_softmax_large_number", 1, 1},
  782. {"test_softmax_large_number_expanded", 1, 1},
  783. {"test_softmax_negative_axis", 1, 1},
  784. {"test_softmax_negative_axis_expanded", 1, 1},
  785. {"test_softplus", 1, 1},
  786. {"test_softplus_example", 1, 1},
  787. {"test_softsign", 1, 1},
  788. {"test_softsign_example", 1, 1},
  789. {"test_spacetodepth", 1, 1},
  790. {"test_spacetodepth_example", 1, 1},
  791. {"test_split_equal_parts_1d", 1, 3},
  792. {"test_split_equal_parts_2d", 1, 2},
  793. {"test_split_equal_parts_default_axis", 1, 3},
  794. {"test_split_variable_parts_1d", 2, 2},
  795. {"test_split_variable_parts_2d", 2, 2},
  796. {"test_split_variable_parts_default_axis", 2, 2},
  797. {"test_split_zero_size_splits", 2, 3},
  798. {"test_sqrt", 1, 1},
  799. {"test_sqrt_example", 1, 1},
  800. {"test_squeeze", 2, 1},
  801. {"test_squeeze_negative_axes", 2, 1},
  802. {"test_strnormalizer_export_monday_casesensintive_lower", 1, 1},
  803. {"test_strnormalizer_export_monday_casesensintive_nochangecase", 1, 1},
  804. {"test_strnormalizer_export_monday_casesensintive_upper", 1, 1},
  805. {"test_strnormalizer_export_monday_empty_output", 1, 1},
  806. {"test_strnormalizer_export_monday_insensintive_upper_twodim", 1, 1},
  807. {"test_strnormalizer_nostopwords_nochangecase", 1, 1},
  808. {"test_sub", 2, 1},
  809. {"test_sub_bcast", 2, 1},
  810. {"test_sub_example", 2, 1},
  811. {"test_sub_uint8", 2, 1},
  812. {"test_sum_example", 3, 1},
  813. {"test_sum_one_input", 1, 1},
  814. {"test_sum_two_inputs", 2, 1},
  815. {"test_tan", 1, 1},
  816. {"test_tan_example", 1, 1},
  817. {"test_tanh", 1, 1},
  818. {"test_tanh_example", 1, 1},
  819. {"test_tfidfvectorizer_tf_batch_onlybigrams_skip0", 1, 1},
  820. {"test_tfidfvectorizer_tf_batch_onlybigrams_skip5", 1, 1},
  821. {"test_tfidfvectorizer_tf_batch_uniandbigrams_skip5", 1, 1},
  822. {"test_tfidfvectorizer_tf_only_bigrams_skip0", 1, 1},
  823. {"test_tfidfvectorizer_tf_onlybigrams_levelempty", 1, 1},
  824. {"test_tfidfvectorizer_tf_onlybigrams_skip5", 1, 1},
  825. {"test_tfidfvectorizer_tf_uniandbigrams_skip5", 1, 1},
  826. {"test_thresholdedrelu", 1, 1},
  827. {"test_thresholdedrelu_default", 1, 1},
  828. {"test_thresholdedrelu_example", 1, 1},
  829. {"test_tile", 2, 1},
  830. {"test_tile_precomputed", 2, 1},
  831. {"test_top_k", 2, 2},
  832. {"test_top_k_negative_axis", 2, 2},
  833. {"test_top_k_smallest", 2, 2},
  834. {"test_training_dropout", 3, 1},
  835. {"test_training_dropout_default", 3, 1},
  836. {"test_training_dropout_default_mask", 3, 2},
  837. {"test_training_dropout_mask", 3, 2},
  838. {"test_training_dropout_zero_ratio", 3, 1},
  839. {"test_training_dropout_zero_ratio_mask", 3, 2},
  840. {"test_transpose_all_permutations_0", 1, 1},
  841. {"test_transpose_all_permutations_1", 1, 1},
  842. {"test_transpose_all_permutations_2", 1, 1},
  843. {"test_transpose_all_permutations_3", 1, 1},
  844. {"test_transpose_all_permutations_4", 1, 1},
  845. {"test_transpose_all_permutations_5", 1, 1},
  846. {"test_transpose_default", 1, 1},
  847. {"test_tril", 1, 1},
  848. {"test_tril_neg", 2, 1},
  849. {"test_tril_one_row_neg", 1, 1},
  850. {"test_tril_out_neg", 2, 1},
  851. {"test_tril_out_pos", 2, 1},
  852. {"test_tril_pos", 2, 1},
  853. {"test_tril_square", 1, 1},
  854. {"test_tril_square_neg", 2, 1},
  855. {"test_tril_zero", 2, 1},
  856. {"test_triu", 1, 1},
  857. {"test_triu_neg", 2, 1},
  858. {"test_triu_one_row", 2, 1},
  859. {"test_triu_out_neg_out", 2, 1},
  860. {"test_triu_out_pos", 2, 1},
  861. {"test_triu_pos", 2, 1},
  862. {"test_triu_square", 1, 1},
  863. {"test_triu_square_neg", 2, 1},
  864. {"test_triu_zero", 2, 1},
  865. {"test_unique_not_sorted_without_axis", 1, 4},
  866. {"test_unique_sorted_with_axis", 1, 4},
  867. {"test_unique_sorted_with_axis_3d", 1, 4},
  868. {"test_unique_sorted_with_negative_axis", 1, 4},
  869. {"test_unique_sorted_without_axis", 1, 4},
  870. {"test_unsqueeze_axis_0", 2, 1},
  871. {"test_unsqueeze_axis_1", 2, 1},
  872. {"test_unsqueeze_axis_2", 2, 1},
  873. {"test_unsqueeze_axis_3", 1, 1},
  874. {"test_unsqueeze_negative_axes", 2, 1},
  875. {"test_unsqueeze_three_axes", 2, 1},
  876. {"test_unsqueeze_two_axes", 2, 1},
  877. {"test_unsqueeze_unsorted_axes", 2, 1},
  878. {"test_upsample_nearest", 2, 1},
  879. {"test_where_example", 3, 1},
  880. {"test_where_long_example", 3, 1},
  881. {"test_xor2d", 2, 1},
  882. {"test_xor3d", 2, 1},
  883. {"test_xor4d", 2, 1},
  884. {"test_xor_bcast3v1d", 2, 1},
  885. {"test_xor_bcast3v2d", 2, 1},
  886. {"test_xor_bcast4v2d", 2, 1},
  887. {"test_xor_bcast4v3d", 2, 1},
  888. {"test_xor_bcast4v4d", 2, 1},
  889. };
  890. std::ostream& operator<<(std::ostream& os, const TestCase& test_case)
  891. {
  892. return os << test_case.name;
  893. }
  894. typedef tuple<TestCase, tuple<Backend, Target> > ONNXConfParams;
  895. std::string printOnnxConfParams(const testing::TestParamInfo<ONNXConfParams>& params)
  896. {
  897. TestCase test_case = get<0>(params.param);
  898. Backend backend = get<0>(get<1>(params.param));
  899. Target target = get<1>(get<1>(params.param));
  900. std::stringstream ss;
  901. ss << test_case.name << "_";
  902. PrintTo(backend, &ss);
  903. ss << "_";
  904. PrintTo(target, &ss);
  905. return ss.str();
  906. }
  907. class Test_ONNX_conformance : public TestWithParam<ONNXConfParams>
  908. {
  909. public:
  910. TestCase test_case;
  911. Backend backend;
  912. Target target;
  913. double default_l1;
  914. double default_lInf;
  915. static std::set<std::string> parser_deny_list;
  916. static std::set<std::string> global_deny_list;
  917. static std::set<std::string> opencl_fp16_deny_list;
  918. static std::set<std::string> opencl_deny_list;
  919. static std::set<std::string> cpu_deny_list;
  920. #ifdef HAVE_HALIDE
  921. static std::set<std::string> halide_deny_list;
  922. #endif
  923. #ifdef HAVE_VULKAN
  924. static std::set<std::string> vulkan_deny_list;
  925. #endif
  926. #ifdef HAVE_CUDA
  927. static std::set<std::string> cuda_deny_list;
  928. #endif
  929. Test_ONNX_conformance()
  930. {
  931. test_case = get<0>(GetParam());
  932. backend = get<0>(get<1>(GetParam()));
  933. target = get<1>(get<1>(GetParam()));
  934. if (target == DNN_TARGET_CUDA_FP16 || target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
  935. {
  936. default_l1 = 4e-3;
  937. default_lInf = 2e-2;
  938. }
  939. else
  940. {
  941. default_l1 = 1e-5;
  942. default_lInf = 1e-4;
  943. }
  944. }
  945. bool checkFallbacks(Net& net) const
  946. {
  947. // Check if all the layers are supported with current backend and target.
  948. // Some layers might be fused so their timings equal to zero.
  949. std::vector<double> timings;
  950. net.getPerfProfile(timings);
  951. std::vector<std::string> names = net.getLayerNames();
  952. CV_CheckEQ(names.size(), timings.size(), "DNN critical error");
  953. bool hasFallbacks = false;
  954. for (int i = 0; i < names.size(); ++i)
  955. {
  956. Ptr<dnn::Layer> l = net.getLayer(net.getLayerId(names[i]));
  957. bool fused = timings[i] == 0.;
  958. if ((!l->supportBackend(backend) || l->preferableTarget != target) && !fused)
  959. {
  960. hasFallbacks = true;
  961. std::cout << "FALLBACK: Layer [" << l->type << "]:[" << l->name << "] is expected to has backend implementation" << endl;
  962. }
  963. }
  964. return hasFallbacks;
  965. }
  966. static void SetUpTestCase()
  967. {
  968. parser_deny_list = {
  969. #include "test_onnx_conformance_layer_parser_denylist.inl.hpp"
  970. };
  971. global_deny_list = {
  972. #include "test_onnx_conformance_layer_filter_opencv_all_denylist.inl.hpp"
  973. };
  974. opencl_fp16_deny_list = {
  975. #include "test_onnx_conformance_layer_filter_opencv_ocl_fp16_denylist.inl.hpp"
  976. };
  977. opencl_deny_list = {
  978. #include "test_onnx_conformance_layer_filter_opencv_ocl_fp32_denylist.inl.hpp"
  979. };
  980. cpu_deny_list = {
  981. #include "test_onnx_conformance_layer_filter_opencv_cpu_denylist.inl.hpp"
  982. };
  983. #ifdef HAVE_HALIDE
  984. halide_deny_list = {
  985. #include "test_onnx_conformance_layer_filter__halide_denylist.inl.hpp"
  986. };
  987. #endif
  988. #ifdef HAVE_VULKAN
  989. vulkan_deny_list = {
  990. #include "test_onnx_conformance_layer_filter__vulkan_denylist.inl.hpp"
  991. };
  992. #endif
  993. #ifdef HAVE_CUDA
  994. cuda_deny_list = {
  995. #include "test_onnx_conformance_layer_filter__cuda_denylist.inl.hpp"
  996. };
  997. #endif
  998. }
  999. };
  1000. std::set<std::string> Test_ONNX_conformance::parser_deny_list;
  1001. std::set<std::string> Test_ONNX_conformance::global_deny_list;
  1002. std::set<std::string> Test_ONNX_conformance::opencl_fp16_deny_list;
  1003. std::set<std::string> Test_ONNX_conformance::opencl_deny_list;
  1004. std::set<std::string> Test_ONNX_conformance::cpu_deny_list;
  1005. #ifdef HAVE_HALIDE
  1006. std::set<std::string> Test_ONNX_conformance::halide_deny_list;
  1007. #endif
  1008. #ifdef HAVE_VULKAN
  1009. std::set<std::string> Test_ONNX_conformance::vulkan_deny_list;
  1010. #endif
  1011. #ifdef HAVE_CUDA
  1012. std::set<std::string> Test_ONNX_conformance::cuda_deny_list;
  1013. #endif
  1014. TEST_P(Test_ONNX_conformance, Layer_Test)
  1015. {
  1016. const std::string& name = test_case.name;
  1017. ASSERT_FALSE(name.empty());
  1018. bool checkLayersFallbacks = true;
  1019. bool checkAccuracy = true;
  1020. if (parser_deny_list.find(name) != parser_deny_list.end())
  1021. {
  1022. applyTestTag(CV_TEST_TAG_DNN_SKIP_PARSER, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1023. }
  1024. if (backend == DNN_BACKEND_OPENCV)
  1025. {
  1026. if (global_deny_list.find(name) != global_deny_list.end())
  1027. {
  1028. applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCV_BACKEND, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1029. }
  1030. if ((target == DNN_TARGET_OPENCL_FP16) && (opencl_fp16_deny_list.find(name) != opencl_fp16_deny_list.end()))
  1031. {
  1032. applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_OPENCV_BACKEND, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1033. }
  1034. if ((target == DNN_TARGET_OPENCL) && (opencl_deny_list.find(name) != opencl_deny_list.end()))
  1035. {
  1036. applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCV_BACKEND, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1037. }
  1038. if ((target == DNN_TARGET_CPU) && (cpu_deny_list.find(name) != cpu_deny_list.end()))
  1039. {
  1040. applyTestTag(CV_TEST_TAG_DNN_SKIP_CPU, CV_TEST_TAG_DNN_SKIP_OPENCV_BACKEND, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1041. }
  1042. }
  1043. #ifdef HAVE_HALIDE
  1044. else if (backend == DNN_BACKEND_HALIDE)
  1045. {
  1046. if (halide_deny_list.find(name) != halide_deny_list.end())
  1047. {
  1048. applyTestTag(CV_TEST_TAG_DNN_SKIP_HALIDE, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1049. }
  1050. }
  1051. #endif
  1052. #ifdef HAVE_INF_ENGINE
  1053. else if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
  1054. {
  1055. #include "test_onnx_conformance_layer_filter__openvino.inl.hpp"
  1056. }
  1057. #endif
  1058. #ifdef HAVE_VULKAN
  1059. else if (backend == DNN_BACKEND_VKCOM)
  1060. {
  1061. if (vulkan_deny_list.find(name) != vulkan_deny_list.end())
  1062. {
  1063. applyTestTag(CV_TEST_TAG_DNN_SKIP_VULKAN, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1064. }
  1065. }
  1066. #endif
  1067. #ifdef HAVE_CUDA
  1068. else if (backend == DNN_BACKEND_CUDA)
  1069. {
  1070. if (cuda_deny_list.find(name) != cuda_deny_list.end())
  1071. {
  1072. applyTestTag(CV_TEST_TAG_DNN_SKIP_CUDA, CV_TEST_TAG_DNN_SKIP_ONNX_CONFORMANCE);
  1073. }
  1074. }
  1075. #endif
  1076. else
  1077. {
  1078. std::ostringstream ss;
  1079. ss << "No test filter available for backend ";
  1080. PrintTo(backend, &ss);
  1081. ss << ". Run test by default";
  1082. std::cout << ss.str() << std::endl;
  1083. }
  1084. std::vector<Mat> inputs;
  1085. std::vector<Mat> ref_outputs;
  1086. std::string prefix = cv::format("dnn/onnx/conformance/node/%s", test_case.name);
  1087. Net net;
  1088. try
  1089. {
  1090. std::string model_path = findDataFile(prefix + "/model.onnx");
  1091. //cout << "Read ONNX inputs..." << endl;
  1092. for (int i = 0; i < test_case.inputs; ++i)
  1093. {
  1094. Mat input = readTensorFromONNX(findDataFile(prefix + cv::format("/test_data_set_0/input_%d.pb", i)));
  1095. inputs.push_back(input);
  1096. }
  1097. //cout << "Read ONNX reference outputs..." << endl;
  1098. for (int i = 0; i < test_case.outputs; ++i)
  1099. {
  1100. Mat output = readTensorFromONNX(findDataFile(prefix + cv::format("/test_data_set_0/output_%d.pb", i)));
  1101. ref_outputs.push_back(output);
  1102. }
  1103. //cout << "Parse model..." << endl;
  1104. net = readNetFromONNX(model_path);
  1105. if (net.empty())
  1106. {
  1107. applyTestTag(CV_TEST_TAG_DNN_ERROR_PARSER);
  1108. }
  1109. }
  1110. catch (...)
  1111. {
  1112. cout << "Exception during ONNX model parse / loading input / loading reference data!" << endl;
  1113. applyTestTag(CV_TEST_TAG_DNN_ERROR_PARSER);
  1114. throw;
  1115. }
  1116. ASSERT_FALSE(net.empty());
  1117. std::vector<std::string> inputNames;
  1118. for (int i = 0; i < inputs.size(); ++i)
  1119. inputNames.push_back(cv::format("%d", i));
  1120. net.setInputsNames(inputNames);
  1121. try
  1122. {
  1123. net.setPreferableBackend(backend);
  1124. net.setPreferableTarget(target);
  1125. for (int i = 0; i < inputs.size(); ++i)
  1126. {
  1127. net.setInput(inputs[i], inputNames[i]);
  1128. }
  1129. }
  1130. catch (...)
  1131. {
  1132. cout << "Exception during network configuration!" << endl;
  1133. applyTestTag(CV_TEST_TAG_DNN_ERROR_NET_SETUP);
  1134. throw;
  1135. }
  1136. std::vector<std::string> layerNames = net.getUnconnectedOutLayersNames();
  1137. std::vector<Mat> outputs;
  1138. try
  1139. {
  1140. net.forward(outputs, layerNames);
  1141. }
  1142. catch (...)
  1143. {
  1144. cout << "Exception during net.forward() call!" << endl;
  1145. applyTestTag(CV_TEST_TAG_DNN_ERROR_FORWARD);
  1146. throw;
  1147. }
  1148. ASSERT_GE(outputs.size(), 1);
  1149. if (checkLayersFallbacks && checkFallbacks(net))
  1150. {
  1151. applyTestTag(CV_TEST_TAG_DNN_LAYER_FALLBACK);
  1152. }
  1153. if (checkAccuracy)
  1154. {
  1155. try
  1156. {
  1157. if (ref_outputs.size() == 1)
  1158. {
  1159. // probably we found random unconnected layers.
  1160. normAssert(ref_outputs[0], outputs[0], "", default_l1, default_lInf);
  1161. }
  1162. else
  1163. {
  1164. ASSERT_EQ(outputs.size(), ref_outputs.size());
  1165. for (size_t i = 0; i < ref_outputs.size(); ++i)
  1166. {
  1167. normAssert(ref_outputs[i], outputs[i], "", default_l1, default_lInf);
  1168. }
  1169. }
  1170. }
  1171. catch (...)
  1172. {
  1173. cout << "Exception during accuracy check!" << endl;
  1174. throw;
  1175. }
  1176. }
  1177. else
  1178. {
  1179. applyTestTag(CV_TEST_TAG_DNN_NO_ACCURACY_CHECK);
  1180. }
  1181. if (!HasFailure())
  1182. cout << "Test passed!" << endl;
  1183. }
  1184. INSTANTIATE_TEST_CASE_P(/**/, Test_ONNX_conformance,
  1185. testing::Combine(
  1186. testing::ValuesIn(testConformanceConfig),
  1187. dnnBackendsAndTargets(/*withInferenceEngine=*/true, /*withHalide=*/true)
  1188. ),
  1189. printOnnxConfParams
  1190. );
  1191. };