diff --git a/tests/python/frontend/onnx/test_forward.py b/tests/python/frontend/onnx/test_forward.py index 8b633c18977a..4a7229e43fbb 100644 --- a/tests/python/frontend/onnx/test_forward.py +++ b/tests/python/frontend/onnx/test_forward.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +import glob import os import re @@ -4418,317 +4419,323 @@ def verify_eyelike(indata): from onnx import numpy_helper -f = onnx.__file__ -import glob +onnx_test_node_dir = os.path.join(os.path.dirname(onnx.__file__), "backend", "test", "data", "node") -onnx_test_folders = sorted(glob.glob("/".join(f.split("/")[0:-1]) + "/backend/test/data/node/*/")) +onnx_test_folders = sorted( + dirname + for dirname in os.listdir(onnx_test_node_dir) + if dirname.startswith("test") and os.path.isdir(os.path.join(onnx_test_node_dir, dirname)) +) unsupported_onnx_tests = [ - "test_adagrad/", - "test_adagrad_multiple/", - "test_adam/", - "test_adam_multiple/", - "test_argmax_default_axis_example_select_last_index/", - "test_argmax_default_axis_random_select_last_index/", - "test_argmax_keepdims_example_select_last_index/", - "test_argmax_keepdims_random_select_last_index/", - "test_argmax_negative_axis_keepdims_example_select_last_index/", - "test_argmax_negative_axis_keepdims_random_select_last_index/", - "test_argmax_no_keepdims_example_select_last_index/", - "test_argmax_no_keepdims_random_select_last_index/", - "test_argmin_default_axis_example_select_last_index/", - "test_argmin_default_axis_random_select_last_index/", - "test_argmin_keepdims_example_select_last_index/", - "test_argmin_keepdims_random_select_last_index/", - "test_argmin_negative_axis_keepdims_example_select_last_index/", - "test_argmin_negative_axis_keepdims_random_select_last_index/", - "test_argmin_no_keepdims_example_select_last_index/", - "test_argmin_no_keepdims_random_select_last_index/", - "test_cast_BFLOAT16_to_FLOAT/", - "test_cast_DOUBLE_to_FLOAT16/", - "test_cast_FLOAT_to_BFLOAT16/", - "test_cast_FLOAT_to_STRING/", - "test_cast_STRING_to_FLOAT/", - "test_celu/", - "test_compress_0/", - "test_compress_1/", - "test_compress_default_axis/", - "test_compress_negative_axis/", - "test_convtranspose_dilations/", - "test_convtranspose_output_shape/", - "test_cumsum_1d/", - "test_cumsum_1d_exclusive/", - "test_cumsum_1d_reverse/", - "test_cumsum_1d_reverse_exclusive/", - "test_cumsum_2d_axis_0/", - "test_cumsum_2d_axis_1/", - "test_cumsum_2d_negative_axis/", - "test_det_2d/", - "test_det_nd/", - "test_dropout_default/", - "test_dropout_default_mask/", - "test_dropout_default_mask_ratio/", - "test_dropout_default_ratio/", - "test_einsum_batch_diagonal/", - "test_einsum_batch_matmul/", - "test_einsum_inner_prod/", - "test_einsum_sum/", - "test_einsum_transpose/", - "test_greater_equal/", - "test_greater_equal_bcast/", - "test_hardmax_axis_0/", - "test_hardmax_axis_1/", - "test_hardmax_default_axis/", - "test_if_seq/", - "test_less_equal/", - "test_less_equal_bcast/", - "test_logsoftmax_axis_0/", - "test_logsoftmax_axis_0_expanded/", - "test_logsoftmax_axis_1/", - "test_logsoftmax_axis_1_expanded/", - "test_logsoftmax_axis_2_expanded/", - "test_logsoftmax_default_axis/", - "test_logsoftmax_default_axis_expanded/", - "test_logsoftmax_example_1_expanded/", - "test_logsoftmax_large_number_expanded/", - "test_logsoftmax_negative_axis_expanded/", - "test_loop11/", - "test_loop13_seq/", - "test_matmulinteger/", - "test_maxpool_2d_same_lower/", - "test_maxpool_2d_same_upper/", - "test_maxpool_with_argmax_2d_precomputed_pads/", - "test_maxpool_with_argmax_2d_precomputed_strides/", - "test_maxunpool_export_with_output_shape/", - "test_momentum/", - "test_momentum_multiple/", - "test_mvn/", - "test_nesterov_momentum/", - "test_nllloss_NC/", - "test_nllloss_NC_expanded/", - "test_nllloss_NCd1/", - "test_nllloss_NCd1_expanded/", - "test_nllloss_NCd1_ii/", - "test_nllloss_NCd1_ii_expanded/", - "test_nllloss_NCd1_mean_weight_negative_ii/", - "test_nllloss_NCd1_mean_weight_negative_ii_expanded/", - "test_nllloss_NCd1_weight/", - "test_nllloss_NCd1_weight_expanded/", - "test_nllloss_NCd1_weight_ii/", - "test_nllloss_NCd1_weight_ii_expanded/", - "test_nllloss_NCd1d2/", - "test_nllloss_NCd1d2_expanded/", - "test_nllloss_NCd1d2_no_weight_reduction_mean_ii/", - "test_nllloss_NCd1d2_no_weight_reduction_mean_ii_expanded/", - "test_nllloss_NCd1d2_reduction_mean/", - "test_nllloss_NCd1d2_reduction_mean_expanded/", - "test_nllloss_NCd1d2_reduction_sum/", - "test_nllloss_NCd1d2_reduction_sum_expanded/", - "test_nllloss_NCd1d2_with_weight/", - "test_nllloss_NCd1d2_with_weight_expanded/", - "test_nllloss_NCd1d2_with_weight_reduction_mean/", - "test_nllloss_NCd1d2_with_weight_reduction_mean_expanded/", - "test_nllloss_NCd1d2_with_weight_reduction_sum/", - "test_nllloss_NCd1d2_with_weight_reduction_sum_expanded/", - "test_nllloss_NCd1d2_with_weight_reduction_sum_ii/", - "test_nllloss_NCd1d2_with_weight_reduction_sum_ii_expanded/", - "test_nllloss_NCd1d2d3_none_no_weight_negative_ii/", - "test_nllloss_NCd1d2d3_none_no_weight_negative_ii_expanded/", - "test_nllloss_NCd1d2d3_sum_weight_high_ii/", - "test_nllloss_NCd1d2d3_sum_weight_high_ii_expanded/", - "test_nllloss_NCd1d2d3d4d5_mean_weight/", - "test_nllloss_NCd1d2d3d4d5_mean_weight_expanded/", - "test_nllloss_NCd1d2d3d4d5_none_no_weight/", - "test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded/", - "test_pow_types_float/", - "test_pow_types_float32_int32/", - "test_pow_types_float32_int64/", - "test_pow_types_float32_uint32/", - "test_pow_types_float32_uint64/", - "test_pow_types_int/", - "test_pow_types_int32_float32/", - "test_pow_types_int32_int32/", - "test_pow_types_int64_float32/", - "test_pow_types_int64_int64/", - "test_qlinearmatmul_2D/", - "test_qlinearmatmul_3D/", - "test_reduce_sum_default_axes_keepdims_example/", - "test_reduce_sum_default_axes_keepdims_random/", - "test_reduce_sum_do_not_keepdims_example/", - "test_reduce_sum_do_not_keepdims_random/", - "test_reduce_sum_empty_axes_input_noop_example/", - "test_reduce_sum_empty_axes_input_noop_random/", - "test_reduce_sum_keepdims_example/", - "test_reduce_sum_keepdims_random/", - "test_reduce_sum_negative_axes_keepdims_example/", - "test_reduce_sum_negative_axes_keepdims_random/", - "test_resize_downsample_sizes_cubic/", - "test_resize_downsample_sizes_linear_pytorch_half_pixel/", - "test_resize_downsample_sizes_nearest/", - "test_resize_tf_crop_and_resize/", - "test_resize_upsample_sizes_cubic/", - "test_resize_upsample_sizes_nearest/", - "test_resize_upsample_sizes_nearest_ceil_half_pixel/", - "test_resize_upsample_sizes_nearest_floor_align_corners/", - "test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric/", - "test_rnn_seq_length/", - "test_round/", - "test_scan9_sum/", - "test_scan_sum/", - "test_sce_NCd1_mean_weight_negative_ii/", - "test_sce_NCd1_mean_weight_negative_ii_expanded/", - "test_sce_NCd1_mean_weight_negative_ii_log_prob/", - "test_sce_NCd1_mean_weight_negative_ii_log_prob_expanded/", - "test_sce_NCd1d2d3_none_no_weight_negative_ii/", - "test_sce_NCd1d2d3_none_no_weight_negative_ii_expanded/", - "test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob/", - "test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob_expanded/", - "test_sce_NCd1d2d3_sum_weight_high_ii/", - "test_sce_NCd1d2d3_sum_weight_high_ii_expanded/", - "test_sce_NCd1d2d3_sum_weight_high_ii_log_prob/", - "test_sce_NCd1d2d3_sum_weight_high_ii_log_prob_expanded/", - "test_sce_NCd1d2d3d4d5_mean_weight/", - "test_sce_NCd1d2d3d4d5_mean_weight_expanded/", - "test_sce_NCd1d2d3d4d5_mean_weight_log_prob/", - "test_sce_NCd1d2d3d4d5_mean_weight_log_prob_expanded/", - "test_sce_NCd1d2d3d4d5_none_no_weight/", - "test_sce_NCd1d2d3d4d5_none_no_weight_expanded/", - "test_sce_NCd1d2d3d4d5_none_no_weight_log_prob/", - "test_sce_NCd1d2d3d4d5_none_no_weight_log_prob_expanded/", - "test_sce_mean/", - "test_sce_mean_3d/", - "test_sce_mean_3d_expanded/", - "test_sce_mean_3d_log_prob/", - "test_sce_mean_3d_log_prob_expanded/", - "test_sce_mean_expanded/", - "test_sce_mean_log_prob/", - "test_sce_mean_log_prob_expanded/", - "test_sce_mean_no_weight_ii/", - "test_sce_mean_no_weight_ii_3d/", - "test_sce_mean_no_weight_ii_3d_expanded/", - "test_sce_mean_no_weight_ii_3d_log_prob/", - "test_sce_mean_no_weight_ii_3d_log_prob_expanded/", - "test_sce_mean_no_weight_ii_4d/", - "test_sce_mean_no_weight_ii_4d_expanded/", - "test_sce_mean_no_weight_ii_4d_log_prob/", - "test_sce_mean_no_weight_ii_4d_log_prob_expanded/", - "test_sce_mean_no_weight_ii_expanded/", - "test_sce_mean_no_weight_ii_log_prob/", - "test_sce_mean_no_weight_ii_log_prob_expanded/", - "test_sce_mean_weight/", - "test_sce_mean_weight_expanded/", - "test_sce_mean_weight_ii/", - "test_sce_mean_weight_ii_3d/", - "test_sce_mean_weight_ii_3d_expanded/", - "test_sce_mean_weight_ii_3d_log_prob/", - "test_sce_mean_weight_ii_3d_log_prob_expanded/", - "test_sce_mean_weight_ii_4d/", - "test_sce_mean_weight_ii_4d_expanded/", - "test_sce_mean_weight_ii_4d_log_prob/", - "test_sce_mean_weight_ii_4d_log_prob_expanded/", - "test_sce_mean_weight_ii_expanded/", - "test_sce_mean_weight_ii_log_prob/", - "test_sce_mean_weight_ii_log_prob_expanded/", - "test_sce_mean_weight_log_prob/", - "test_sce_mean_weight_log_prob_expanded/", - "test_sce_none/", - "test_sce_none_expanded/", - "test_sce_none_log_prob/", - "test_sce_none_log_prob_expanded/", - "test_sce_none_weights/", - "test_sce_none_weights_expanded/", - "test_sce_none_weights_log_prob/", - "test_sce_none_weights_log_prob_expanded/", - "test_sce_sum/", - "test_sce_sum_expanded/", - "test_sce_sum_log_prob/", - "test_sce_sum_log_prob_expanded/", - "test_sequence_insert_at_back/", - "test_sequence_insert_at_front/", - "test_simple_rnn_defaults/", - "test_simple_rnn_with_initial_bias/", - "test_softmax_axis_0/", - "test_softmax_axis_0_expanded/", - "test_softmax_axis_1/", - "test_softmax_axis_1_expanded/", - "test_softmax_axis_2_expanded/", - "test_softmax_default_axis/", - "test_softmax_default_axis_expanded/", - "test_softmax_example_expanded/", - "test_softmax_large_number_expanded/", - "test_softmax_negative_axis_expanded/", - "test_split_variable_parts_1d/", - "test_split_variable_parts_2d/", - "test_split_variable_parts_default_axis/", - "test_split_zero_size_splits/", - "test_squeeze/", - "test_squeeze_negative_axes/", - "test_strnormalizer_export_monday_casesensintive_lower/", - "test_strnormalizer_export_monday_casesensintive_nochangecase/", - "test_strnormalizer_export_monday_casesensintive_upper/", - "test_strnormalizer_export_monday_empty_output/", - "test_strnormalizer_export_monday_insensintive_upper_twodim/", - "test_strnormalizer_nostopwords_nochangecase/", - "test_tfidfvectorizer_tf_batch_onlybigrams_skip0/", - "test_tfidfvectorizer_tf_batch_onlybigrams_skip5/", - "test_tfidfvectorizer_tf_batch_uniandbigrams_skip5/", - "test_tfidfvectorizer_tf_only_bigrams_skip0/", - "test_tfidfvectorizer_tf_onlybigrams_levelempty/", - "test_tfidfvectorizer_tf_onlybigrams_skip5/", - "test_tfidfvectorizer_tf_uniandbigrams_skip5/", - "test_training_dropout/", - "test_training_dropout_default/", - "test_training_dropout_default_mask/", - "test_training_dropout_mask/", - "test_training_dropout_zero_ratio/", - "test_training_dropout_zero_ratio_mask/", - "test_unique_sorted_with_axis/", - "test_unique_sorted_with_axis_3d/", - "test_unique_sorted_with_negative_axis/", - "test_unsqueeze_axis_0/", - "test_unsqueeze_axis_1/", - "test_unsqueeze_axis_2/", - "test_unsqueeze_negative_axes/", - "test_unsqueeze_three_axes/", - "test_unsqueeze_two_axes/", - "test_unsqueeze_unsorted_axes/", - "test_upsample_nearest/", + "test_adagrad", + "test_adagrad_multiple", + "test_adam", + "test_adam_multiple", + "test_argmax_default_axis_example_select_last_index", + "test_argmax_default_axis_random_select_last_index", + "test_argmax_keepdims_example_select_last_index", + "test_argmax_keepdims_random_select_last_index", + "test_argmax_negative_axis_keepdims_example_select_last_index", + "test_argmax_negative_axis_keepdims_random_select_last_index", + "test_argmax_no_keepdims_example_select_last_index", + "test_argmax_no_keepdims_random_select_last_index", + "test_argmin_default_axis_example_select_last_index", + "test_argmin_default_axis_random_select_last_index", + "test_argmin_keepdims_example_select_last_index", + "test_argmin_keepdims_random_select_last_index", + "test_argmin_negative_axis_keepdims_example_select_last_index", + "test_argmin_negative_axis_keepdims_random_select_last_index", + "test_argmin_no_keepdims_example_select_last_index", + "test_argmin_no_keepdims_random_select_last_index", + "test_cast_BFLOAT16_to_FLOAT", + "test_cast_DOUBLE_to_FLOAT16", + "test_cast_FLOAT_to_BFLOAT16", + "test_cast_FLOAT_to_STRING", + "test_cast_STRING_to_FLOAT", + "test_celu", + "test_compress_0", + "test_compress_1", + "test_compress_default_axis", + "test_compress_negative_axis", + "test_convtranspose_dilations", + "test_convtranspose_output_shape", + "test_cumsum_1d", + "test_cumsum_1d_exclusive", + "test_cumsum_1d_reverse", + "test_cumsum_1d_reverse_exclusive", + "test_cumsum_2d_axis_0", + "test_cumsum_2d_axis_1", + "test_cumsum_2d_negative_axis", + "test_det_2d", + "test_det_nd", + "test_dropout_default", + "test_dropout_default_mask", + "test_dropout_default_mask_ratio", + "test_dropout_default_ratio", + "test_einsum_batch_diagonal", + "test_einsum_batch_matmul", + "test_einsum_inner_prod", + "test_einsum_sum", + "test_einsum_transpose", + "test_greater_equal", + "test_greater_equal_bcast", + "test_hardmax_axis_0", + "test_hardmax_axis_1", + "test_hardmax_default_axis", + "test_if_seq", + "test_less_equal", + "test_less_equal_bcast", + "test_logsoftmax_axis_0", + "test_logsoftmax_axis_0_expanded", + "test_logsoftmax_axis_1", + "test_logsoftmax_axis_1_expanded", + "test_logsoftmax_axis_2_expanded", + "test_logsoftmax_default_axis", + "test_logsoftmax_default_axis_expanded", + "test_logsoftmax_example_1_expanded", + "test_logsoftmax_large_number_expanded", + "test_logsoftmax_negative_axis_expanded", + "test_loop11", + "test_loop13_seq", + "test_matmulinteger", + "test_maxpool_2d_same_lower", + "test_maxpool_2d_same_upper", + "test_maxpool_with_argmax_2d_precomputed_pads", + "test_maxpool_with_argmax_2d_precomputed_strides", + "test_maxunpool_export_with_output_shape", + "test_momentum", + "test_momentum_multiple", + "test_mvn", + "test_nesterov_momentum", + "test_nllloss_NC", + "test_nllloss_NC_expanded", + "test_nllloss_NCd1", + "test_nllloss_NCd1_expanded", + "test_nllloss_NCd1_ii", + "test_nllloss_NCd1_ii_expanded", + "test_nllloss_NCd1_mean_weight_negative_ii", + "test_nllloss_NCd1_mean_weight_negative_ii_expanded", + "test_nllloss_NCd1_weight", + "test_nllloss_NCd1_weight_expanded", + "test_nllloss_NCd1_weight_ii", + "test_nllloss_NCd1_weight_ii_expanded", + "test_nllloss_NCd1d2", + "test_nllloss_NCd1d2_expanded", + "test_nllloss_NCd1d2_no_weight_reduction_mean_ii", + "test_nllloss_NCd1d2_no_weight_reduction_mean_ii_expanded", + "test_nllloss_NCd1d2_reduction_mean", + "test_nllloss_NCd1d2_reduction_mean_expanded", + "test_nllloss_NCd1d2_reduction_sum", + "test_nllloss_NCd1d2_reduction_sum_expanded", + "test_nllloss_NCd1d2_with_weight", + "test_nllloss_NCd1d2_with_weight_expanded", + "test_nllloss_NCd1d2_with_weight_reduction_mean", + "test_nllloss_NCd1d2_with_weight_reduction_mean_expanded", + "test_nllloss_NCd1d2_with_weight_reduction_sum", + "test_nllloss_NCd1d2_with_weight_reduction_sum_expanded", + "test_nllloss_NCd1d2_with_weight_reduction_sum_ii", + "test_nllloss_NCd1d2_with_weight_reduction_sum_ii_expanded", + "test_nllloss_NCd1d2d3_none_no_weight_negative_ii", + "test_nllloss_NCd1d2d3_none_no_weight_negative_ii_expanded", + "test_nllloss_NCd1d2d3_sum_weight_high_ii", + "test_nllloss_NCd1d2d3_sum_weight_high_ii_expanded", + "test_nllloss_NCd1d2d3d4d5_mean_weight", + "test_nllloss_NCd1d2d3d4d5_mean_weight_expanded", + "test_nllloss_NCd1d2d3d4d5_none_no_weight", + "test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded", + "test_pow_types_float", + "test_pow_types_float32_int32", + "test_pow_types_float32_int64", + "test_pow_types_float32_uint32", + "test_pow_types_float32_uint64", + "test_pow_types_int", + "test_pow_types_int32_float32", + "test_pow_types_int32_int32", + "test_pow_types_int64_float32", + "test_pow_types_int64_int64", + "test_qlinearmatmul_2D", + "test_qlinearmatmul_3D", + "test_reduce_sum_default_axes_keepdims_example", + "test_reduce_sum_default_axes_keepdims_random", + "test_reduce_sum_do_not_keepdims_example", + "test_reduce_sum_do_not_keepdims_random", + "test_reduce_sum_empty_axes_input_noop_example", + "test_reduce_sum_empty_axes_input_noop_random", + "test_reduce_sum_keepdims_example", + "test_reduce_sum_keepdims_random", + "test_reduce_sum_negative_axes_keepdims_example", + "test_reduce_sum_negative_axes_keepdims_random", + "test_resize_downsample_sizes_cubic", + "test_resize_downsample_sizes_linear_pytorch_half_pixel", + "test_resize_downsample_sizes_nearest", + "test_resize_tf_crop_and_resize", + "test_resize_upsample_sizes_cubic", + "test_resize_upsample_sizes_nearest", + "test_resize_upsample_sizes_nearest_ceil_half_pixel", + "test_resize_upsample_sizes_nearest_floor_align_corners", + "test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric", + "test_rnn_seq_length", + "test_round", + "test_scan9_sum", + "test_scan_sum", + "test_sce_NCd1_mean_weight_negative_ii", + "test_sce_NCd1_mean_weight_negative_ii_expanded", + "test_sce_NCd1_mean_weight_negative_ii_log_prob", + "test_sce_NCd1_mean_weight_negative_ii_log_prob_expanded", + "test_sce_NCd1d2d3_none_no_weight_negative_ii", + "test_sce_NCd1d2d3_none_no_weight_negative_ii_expanded", + "test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob", + "test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob_expanded", + "test_sce_NCd1d2d3_sum_weight_high_ii", + "test_sce_NCd1d2d3_sum_weight_high_ii_expanded", + "test_sce_NCd1d2d3_sum_weight_high_ii_log_prob", + "test_sce_NCd1d2d3_sum_weight_high_ii_log_prob_expanded", + "test_sce_NCd1d2d3d4d5_mean_weight", + "test_sce_NCd1d2d3d4d5_mean_weight_expanded", + "test_sce_NCd1d2d3d4d5_mean_weight_log_prob", + "test_sce_NCd1d2d3d4d5_mean_weight_log_prob_expanded", + "test_sce_NCd1d2d3d4d5_none_no_weight", + "test_sce_NCd1d2d3d4d5_none_no_weight_expanded", + "test_sce_NCd1d2d3d4d5_none_no_weight_log_prob", + "test_sce_NCd1d2d3d4d5_none_no_weight_log_prob_expanded", + "test_sce_mean", + "test_sce_mean_3d", + "test_sce_mean_3d_expanded", + "test_sce_mean_3d_log_prob", + "test_sce_mean_3d_log_prob_expanded", + "test_sce_mean_expanded", + "test_sce_mean_log_prob", + "test_sce_mean_log_prob_expanded", + "test_sce_mean_no_weight_ii", + "test_sce_mean_no_weight_ii_3d", + "test_sce_mean_no_weight_ii_3d_expanded", + "test_sce_mean_no_weight_ii_3d_log_prob", + "test_sce_mean_no_weight_ii_3d_log_prob_expanded", + "test_sce_mean_no_weight_ii_4d", + "test_sce_mean_no_weight_ii_4d_expanded", + "test_sce_mean_no_weight_ii_4d_log_prob", + "test_sce_mean_no_weight_ii_4d_log_prob_expanded", + "test_sce_mean_no_weight_ii_expanded", + "test_sce_mean_no_weight_ii_log_prob", + "test_sce_mean_no_weight_ii_log_prob_expanded", + "test_sce_mean_weight", + "test_sce_mean_weight_expanded", + "test_sce_mean_weight_ii", + "test_sce_mean_weight_ii_3d", + "test_sce_mean_weight_ii_3d_expanded", + "test_sce_mean_weight_ii_3d_log_prob", + "test_sce_mean_weight_ii_3d_log_prob_expanded", + "test_sce_mean_weight_ii_4d", + "test_sce_mean_weight_ii_4d_expanded", + "test_sce_mean_weight_ii_4d_log_prob", + "test_sce_mean_weight_ii_4d_log_prob_expanded", + "test_sce_mean_weight_ii_expanded", + "test_sce_mean_weight_ii_log_prob", + "test_sce_mean_weight_ii_log_prob_expanded", + "test_sce_mean_weight_log_prob", + "test_sce_mean_weight_log_prob_expanded", + "test_sce_none", + "test_sce_none_expanded", + "test_sce_none_log_prob", + "test_sce_none_log_prob_expanded", + "test_sce_none_weights", + "test_sce_none_weights_expanded", + "test_sce_none_weights_log_prob", + "test_sce_none_weights_log_prob_expanded", + "test_sce_sum", + "test_sce_sum_expanded", + "test_sce_sum_log_prob", + "test_sce_sum_log_prob_expanded", + "test_sequence_insert_at_back", + "test_sequence_insert_at_front", + "test_simple_rnn_defaults", + "test_simple_rnn_with_initial_bias", + "test_softmax_axis_0", + "test_softmax_axis_0_expanded", + "test_softmax_axis_1", + "test_softmax_axis_1_expanded", + "test_softmax_axis_2_expanded", + "test_softmax_default_axis", + "test_softmax_default_axis_expanded", + "test_softmax_example_expanded", + "test_softmax_large_number_expanded", + "test_softmax_negative_axis_expanded", + "test_split_variable_parts_1d", + "test_split_variable_parts_2d", + "test_split_variable_parts_default_axis", + "test_split_zero_size_splits", + "test_squeeze", + "test_squeeze_negative_axes", + "test_strnormalizer_export_monday_casesensintive_lower", + "test_strnormalizer_export_monday_casesensintive_nochangecase", + "test_strnormalizer_export_monday_casesensintive_upper", + "test_strnormalizer_export_monday_empty_output", + "test_strnormalizer_export_monday_insensintive_upper_twodim", + "test_strnormalizer_nostopwords_nochangecase", + "test_tfidfvectorizer_tf_batch_onlybigrams_skip0", + "test_tfidfvectorizer_tf_batch_onlybigrams_skip5", + "test_tfidfvectorizer_tf_batch_uniandbigrams_skip5", + "test_tfidfvectorizer_tf_only_bigrams_skip0", + "test_tfidfvectorizer_tf_onlybigrams_levelempty", + "test_tfidfvectorizer_tf_onlybigrams_skip5", + "test_tfidfvectorizer_tf_uniandbigrams_skip5", + "test_training_dropout", + "test_training_dropout_default", + "test_training_dropout_default_mask", + "test_training_dropout_mask", + "test_training_dropout_zero_ratio", + "test_training_dropout_zero_ratio_mask", + "test_unique_sorted_with_axis", + "test_unique_sorted_with_axis_3d", + "test_unique_sorted_with_negative_axis", + "test_unsqueeze_axis_0", + "test_unsqueeze_axis_1", + "test_unsqueeze_axis_2", + "test_unsqueeze_negative_axes", + "test_unsqueeze_three_axes", + "test_unsqueeze_two_axes", + "test_unsqueeze_unsorted_axes", + "test_upsample_nearest", ] -targets = [tgt for (tgt, _) in tvm.testing.enabled_targets()] - target_skips = { "cuda": [ - "test_mod_mixed_sign_float16/", - "test_qlinearconv/", - "test_resize_upsample_sizes_nearest/", + "test_basic_convinteger", + "test_convinteger_with_padding", + "test_range_float_type_positive_delta_expanded", + "test_range_int32_type_positive_delta_expanded", + "test_mod_mixed_sign_float16", + "test_qlinearconv", + "test_resize_upsample_sizes_nearest", ] } -@pytest.mark.parametrize("target", targets) -@pytest.mark.parametrize("test", onnx_test_folders) -def test_onnx_nodes(test, target): - if target in target_skips: - for failure in target_skips[target]: - if failure in test: - pytest.skip() - break - for failure in unsupported_onnx_tests: - if failure in test: - pytest.skip() - break +@pytest.mark.parametrize("onnx_test", onnx_test_folders) +def test_onnx_nodes(target, dev, onnx_test): + target_kind = tvm.target.Target(target).kind.name + + if onnx_test in unsupported_onnx_tests: + pytest.skip(f"Onnx test '{onnx_test}' not yet supported by TVM") + + target_specific_skips = target_skips.get(target_kind, []) + if onnx_test in target_specific_skips: + pytest.skip(f"Onnx test '{onnx_test}' not yet supported by TVM on {target_kind} targets") + + test_dir = os.path.join(onnx_test_node_dir, onnx_test) + atol = 1e-5 rtol = 1e-5 - if "roialign" in test: + if "roialign" in test_dir: # for some reason the ONNX test crops the # roialign results to 4 decimal places atol = 1e-4 - onnx_model = onnx.load(test + "/model.onnx") + onnx_model = onnx.load(test_dir + "/model.onnx") inputs = [] outputs = [] - for dataset in glob.glob(test + "/*/"): + for dataset in glob.glob(test_dir + "/*/"): tensors = sorted(glob.glob(dataset + "/*.pb")) for tensor in tensors: new_tensor = onnx.TensorProto() @@ -4741,7 +4748,6 @@ def test_onnx_nodes(test, target): else: raise ImportError(str(tensor) + " not labeled as an import or an output") - dev = tvm.device(target, 0) tvm_val = get_tvm_output_with_vm(onnx_model, inputs, target, dev) if len(outputs) == 1: tvm.testing.assert_allclose(outputs[0], tvm_val, rtol=rtol, atol=atol)