pytorch

Форк
0
/
onnx_backend_test.py 
204 строки · 10.6 Кб
1
# @package onnx
2
# Module caffe2.python.onnx.tests.onnx_backend_test
3

4

5

6

7

8

9
import os
10
import unittest
11

12
import onnx.backend.test
13

14
import caffe2.python.onnx.backend as c2
15
from caffe2.python import core
16

17
core.SetEnginePref({}, {})
18

19
# This is a pytest magic variable to load extra plugins
20
pytest_plugins = 'onnx.backend.test.report',
21

22
backend_test = onnx.backend.test.BackendTest(c2, __name__)
23

24
backend_test.exclude(r'(test_hardsigmoid'  # Does not support Hardsigmoid.
25
                     '|test_hardmax'  # Does not support Hardmax.
26
                     '|test_.*FLOAT16.*'  # Does not support Cast on Float16.
27
                     '|test_depthtospace.*'  # Does not support DepthToSpace.
28
                     '|test_reduce_l1.*'  # Does not support ReduceL1.
29
                     '|test_reduce_l2.*'  # Does not support ReduceL2.
30
                     '|test_reduce_log_sum.*'  # Does not support ReduceLogSum.
31
                     '|test_reduce_prod.*'  # Does not support ReduceProd.
32
                     '|test_reduce_sum_square.*'  # Does not support ReduceSumSquare
33
                     '|test_det.*'  # Does not support Det
34
                     '|test_range.*'  # Does not support Range
35
                     '|test_tile.*'  # Tile's Caffe2 implementation needs some tweak
36
                     '|test_lstm.*'  # Seems LSTM case has some problem
37
                     '|test_simple_rnn.*'  # Seems simple RNN case has some problem
38
                     '|test_gru.*'  # Seems GRU case has some problem
39
                     '|test_prelu.*'  # PRelu is not compliant with ONNX yet
40
                     '|test_operator_repeat.*'  # Tile is not compliant with ONNX yet
41
                     '|test_.*pool_.*same.*'  # Does not support pool same.
42
                     '|test_.*pool_.*ceil.*'  # Does not support pool same.
43
                     '|test_maxpool_with_argmax.*'  # MaxPool outputs indices in different format.
44
                     '|test_maxpool.*dilation.*'  # MaxPool doesn't support dilation yet.
45
                     '|test_maxpool.*uint8.*'  # MaxPool doesn't support uint8 yet.
46
                     '|test_convtranspose.*'  # ConvTranspose needs some more complicated translation
47
                     '|test_mvn.*'  # MeanVarianceNormalization is experimental and not supported.
48
                     '|test_dynamic_slice.*'  # MeanVarianceNormalization is experimental and not supported.
49
                     '|test_eyelike.*'  # Needs implementation
50
                     '|test_maxunpool.*'  # Needs implementation
51
                     '|test_acosh.*'  # Needs implementation
52
                     '|test_asinh.*'  # Needs implementation
53
                     '|test_atanh.*'  # Needs implementation
54
                     '|test_onehot.*'  # Needs implementation
55
                     '|test_scan.*'  # Needs implementation
56
                     '|test_isnan.*'  # Needs implementation
57
                     '|test_scatter.*'  # Should be similar to ScatterAssign
58
                     '|test_constantofshape_int.*'  # Needs implementation
59
                     '|test_shrink.*'  # Needs implementation
60
                     '|test_strnorm.*'  # Needs implementation
61
                     '|test_nonzero.*'  # Needs implementation
62
                     '|test_tfidfvectorizer.*'  # Needs implementation
63
                     '|test_top_k.*'  # opset 10 is not supported yet
64
                     '|test_resize.*'  # opset 10 is not supported yet
65
                     '|test_slice.*'  # opset 10 is not supported yet
66
                     '|test_.*qlinear.*'  # Skip quantized op test
67
                     '|test_.*quantize.*'  # Skip quantized op test
68
                     '|test_.*matmulinteger.*'  # Skip quantized op test
69
                     '|test_.*convinteger.*'  # Skip quantized op test
70
                     '|test_isinf.*'  # Needs implementation
71
                     '|test_mod.*'  # Needs implementation
72
                     '|test_nonmaxsuppression.*'  # Needs implementation
73
                     '|test_reversesequence.*'  # Needs implementation
74
                     '|test_roialign.*'  # Needs implementation
75
                     '|test_bitshift.*'  # Needs implementation
76
                     '|test_round.*'  # Needs implementation
77
                     '|test_cumsum.*'  # Needs implementation
78
                     '|test_clip.*'  # opset 11 is not supported yet
79
                     '|test_gather_elements.*'  # opset 11 is not supported yet
80
                     '|test_scatter.*'  # opset 11 is not supported yet
81
                     '|test_unique.*'  # opset 11 is not supported yet
82
                     '|test_gathernd.*'  # opset 11 is not supported yet
83
                     '|test_dropout_random.*'  # opset 12 is not supported
84
                     '|test_dropout_default.*'  # opset 12 is not supported
85
                     '|test_einsum.*'  # opset 12 is not supported
86
                     '|test_.*training.*'  # training is not supported
87
                     '|test_.*_loss.*'  # training is not supported
88
                     '|test_split_zero_size.*'  # unsupported case
89
                     '|test_constantofshape_int_shape_zero.*'  # unsupported case
90
                     '|test_constant_pad.*'  # 1d pad is not supported
91
                     '|test_edge_pad.*'  # 1d pad is not supported
92
                     '|test_reflect_pad.*'  # 1d pad is not supported
93
                     '|test_gemm_default_no_bias.*'  # no bias is not supported
94
                     '|test_gemm_default_scalar_bias.*'  # incorrect type
95
                     '|test_sequence_.*'  # type sequence is not supported yet
96
                     '|test_.*negative_ax.*'  # negative axis is not supported yet
97
                     '|test_.*negative_ind.*'  # negative axis is not supported yet
98
                     '|test_argmax_.*select_last_index.*'  # unsupported case
99
                     '|test_argmin_.*select_last_index_.*'  # unsupported case
100
                     '|test_celu.*'  # unsupported case
101
                     '|test_gathernd.*'  # unsupported case
102
                     '|test_greater_equal.*'  # unsupported case
103
                     '|test_less_equal.*'  # unsupported case
104
                     '|test_max_.*'  # unsupported case
105
                     '|test_min_.*'  # unsupported case
106
                     '|test_.*momentum_.*'  # unsupported case
107
                     '|test_sce.*'  # unsupported case
108
                     '|test_nllloss.*'  # unsupported case
109
                     '|test_unfoldtodepth.*'  # unsupported case
110
                     '|test_.*gradient.*'  # no support for gradient op in c2-onnx
111
                     '|test_.*adagrad.*'  # no support for gradient op in c2-onnx
112
                     '|test_.*loss.*'  # no support for loss op in c2-onnx
113
                     '|test_.*adam.*'  # no support for adam op
114
                     '|test_.*identity.*'  # no support for adam op
115
                     ')')
116

117
# Quick patch to unbreak master CI, is working on the debugging.
118
backend_test.exclude('(test_cast_.*'
119
                     '|test_compress_.*'
120
                     '|test_Conv1d_.*cuda'
121
                     '|test_Conv3d_groups_cuda'
122
                     '|test_rnn_seq_length'
123
                     '|test_operator_add.*_cuda'
124
                     '|test_operator_lstm_cuda'
125
                     '|test_operator_rnn.*_cuda'
126
                     '|test_lrn_default_cuda)')
127

128
# Temporarily skip some ONNX backend tests with broadcasting.
129
backend_test.exclude('(test_pow_bcast'
130
                     '|test_pow_types.*'
131
                     ')')
132

133
# Temporarily skip some ONNX backend tests due to updates in opset 13.
134
backend_test.exclude('(test_if_.*'  # added support for sequence type inputs
135
                     '|test_if_seq_.*'  # added support for sequence type inputs
136
                     '|test_logsoftmax_.*'  # axis attr default value changed from 1 to -1
137
                     '|test_loop11_.*'  # seg fault issue
138
                     '|test_loop16_.*'  # seg fault issue
139
                     '|test_loop13_seq_.*'  # no support for sequence inputs for scan input
140
                     '|test_reduce_sum_.*'  # axes is now an input (not attr), added noop_with_empty_axes
141
                     '|test_softmax_.*'  # axis attr default value changed from 1 to -1
142
                     '|test_split_variable_parts_.*'  # axes is now an input (not attr)
143
                     '|test_squeeze_.*'  # axes is now an input (not attr)
144
                     '|test_unsqueeze_.*'  # axes is now an input (not attr)
145
                     '|test_MaxPool1d_stride_padding_dilation_.*'
146
                     '|test_MaxPool2d_stride_padding_dilation_.*'
147
                     ')')
148

149
# Temporarily skip some ONNX backend tests due to updates in opset 14.
150
backend_test.exclude('(test_add_uint8_.*'  # uint8 dtype added
151
                     '|test_div_uint8_.*'  # uint8 dtype added
152
                     '|test_hardswish_.*'  # new operator added
153
                     '|test_mul_uint8_.*'  # uint8 dtype added
154
                     '|test_sub_uint8_.*'  # uint8 dtype added
155
                     '|test_tril_.*'  # new operator added
156
                     '|test_triu_.*'  # new operator added
157
                     '|test_identity_sequence_.*'  # new operator added
158
                     '|test_reshape_allowzero_reordered_.*'
159
                     '|test_conv_with_autopad_same_.*'
160
                     ')')
161

162
# Unsupported ops in opset 15
163
backend_test.exclude('(test_bernoulli_.*'
164
                     '|test_castlike_.*'
165
                     '|test_optional_.*'
166
                     '|test_shape_end_.*'
167
                     '|test_shape_start_.*'
168
                     '|test_identity_opt_*'
169
                     '|test_loop16_seq_none_*'
170
                     '|test_if_opt_*'
171
                     ')')
172

173
# Unsupported ops in opset 16
174
backend_test.exclude('(test_gridsample_.*'
175
                     '|test_spacetodepth_.*'
176
                     ')')
177

178
# Unsupported ops in opset 17
179
backend_test.exclude('(test_layer_normalization_.*'
180
                     '|test_blackmanwindow_.*'
181
                     '|test_dft_.*'
182
                     '|test_hammingwindow_.*'
183
                     '|test_hannwindow_.*'
184
                     '|test_melweightmatrix_.*'
185
                     '|test_stft_.*'
186
                     '|test_sequencemap_.*'
187
                     ')')
188

189
# Unsupported ops in opset 18
190
backend_test.exclude('(test_center_crop_pad_.*'
191
                     '|test_col2im*'
192
                     '|test_bitwise*)')
193

194
# Skip vgg to speed up CI
195
if 'JENKINS_URL' in os.environ:
196
    backend_test.exclude(r'(test_vgg19|test_vgg)')
197

198
# import all test cases at global scope to make them visible to python.unittest
199
globals().update(backend_test
200
                 .enable_report()
201
                 .test_cases)
202

203
if __name__ == '__main__':
204
    unittest.main()
205

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.