5
5
import packaging .version as pv
6
6
import numpy
7
7
from numpy .testing import assert_allclose
8
+ from onnx .defs import onnx_opset_version
8
9
import onnx .backend .base
9
10
import onnx .backend .test
10
11
import onnx .shape_inference
31
32
32
33
class ReferenceImplementationError (RuntimeError ):
33
34
"Fails, export cannot be compared."
34
- pass
35
35
36
36
37
37
class ExportWrapper :
@@ -64,7 +64,8 @@ def run(
64
64
expected = self .expected_sess .run (names , feeds )
65
65
except (RuntimeError , AssertionError , TypeError , KeyError ) as e :
66
66
raise ReferenceImplementationError (
67
- f"ReferenceImplementation fails with { onnx_simple_text_plot (self .model )} "
67
+ f"ReferenceImplementation fails with "
68
+ f"{ onnx_simple_text_plot (self .model )} "
68
69
f"\n --RAW--\n { self .model } "
69
70
) from e
70
71
@@ -85,7 +86,7 @@ def run(
85
86
new_code = "\n " .join (
86
87
[f"{ i + 1 :04} { line } " for i , line in enumerate (code .split ("\n " ))]
87
88
)
88
- raise AssertionError (f"ERROR { e } \n { new_code } " )
89
+ raise AssertionError (f"ERROR { e } \n { new_code } " ) # noqa: B904
89
90
90
91
locs = {
91
92
"np" : numpy ,
@@ -154,7 +155,8 @@ def run(
154
155
):
155
156
if a .tolist () != b .tolist ():
156
157
raise AssertionError (
157
- f"Text discrepancies for api { api !r} with a.dtype={ a .dtype } "
158
+ f"Text discrepancies for api { api !r} "
159
+ f"with a.dtype={ a .dtype } "
158
160
f"and b.dtype={ b .dtype } "
159
161
f"\n --BASE--\n { onnx_simple_text_plot (self .model )} "
160
162
f"\n --EXP[{ api } ]--\n { onnx_simple_text_plot (export_model )} "
@@ -275,6 +277,22 @@ def run_node(cls, node, inputs, device=None, outputs_info=None, **kwargs):
275
277
")"
276
278
)
277
279
280
+ if onnx_opset_version () < 22 :
281
+ backend_test .exclude (
282
+ "("
283
+ "test_dft_inverse_cpu"
284
+ "|test_dft_inverse_opset19_cpu"
285
+ "|test_lppool_1d_default_cpu"
286
+ "|test_lppool_2d_default_cpu"
287
+ "|test_lppool_2d_dilations_cpu"
288
+ "|test_lppool_2d_pads_cpu"
289
+ "|test_lppool_2d_same_lower_cpu"
290
+ "|test_lppool_2d_same_upper_cpu"
291
+ "|test_lppool_2d_strides_cpu"
292
+ "|test_lppool_3d_default_cpu"
293
+ ")"
294
+ )
295
+
278
296
if pv .Version (onnx_version ) < pv .Version ("1.16.0" ):
279
297
backend_test .exclude ("(test_strnorm|test_range_)" )
280
298
0 commit comments