@@ -63,17 +63,40 @@ def sample_inputs(self, *feature_types, filter_metadata=True):
63
63
yield args_kwargs
64
64
65
65
66
- def xfail_python_scalar_arg_jit (name , * , reason = None ):
66
+ def xfail_jit_python_scalar_arg (name , * , reason = None ):
67
67
reason = reason or f"Python scalar int or float for `{ name } ` is not supported when scripting"
68
68
return TestMark (
69
69
("TestDispatchers" , "test_scripted_smoke" ),
70
70
pytest .mark .xfail (reason = reason ),
71
- condition = lambda args_kwargs : isinstance (args_kwargs .kwargs [ name ] , (int , float )),
71
+ condition = lambda args_kwargs : isinstance (args_kwargs .kwargs . get ( name ) , (int , float )),
72
72
)
73
73
74
74
75
- def xfail_integer_size_jit (name = "size" ):
76
- return xfail_python_scalar_arg_jit (name , reason = f"Integer `{ name } ` is not supported when scripting." )
75
+ def xfail_jit_integer_size (name = "size" ):
76
+ return xfail_jit_python_scalar_arg (name , reason = f"Integer `{ name } ` is not supported when scripting." )
77
+
78
+
79
+ def xfail_jit_tuple_instead_of_list (name , * , reason = None ):
80
+ reason = reason or f"Passing a tuple instead of a list for `{ name } ` is not supported when scripting"
81
+ return TestMark (
82
+ ("TestDispatchers" , "test_scripted_smoke" ),
83
+ pytest .mark .xfail (reason = reason ),
84
+ condition = lambda args_kwargs : isinstance (args_kwargs .kwargs .get (name ), tuple ),
85
+ )
86
+
87
+
88
+ def is_list_of_ints (args_kwargs ):
89
+ fill = args_kwargs .kwargs .get ("fill" )
90
+ return isinstance (fill , list ) and any (isinstance (scalar_fill , int ) for scalar_fill in fill )
91
+
92
+
93
+ def xfail_jit_list_of_ints (name , * , reason = None ):
94
+ reason = reason or f"Passing a list of integers for `{ name } ` is not supported when scripting"
95
+ return TestMark (
96
+ ("TestDispatchers" , "test_scripted_smoke" ),
97
+ pytest .mark .xfail (reason = reason ),
98
+ condition = is_list_of_ints ,
99
+ )
77
100
78
101
79
102
skip_dispatch_feature = TestMark (
@@ -123,7 +146,7 @@ def fill_sequence_needs_broadcast(args_kwargs):
123
146
},
124
147
pil_kernel_info = PILKernelInfo (F .resize_image_pil ),
125
148
test_marks = [
126
- xfail_integer_size_jit (),
149
+ xfail_jit_integer_size (),
127
150
],
128
151
),
129
152
DispatcherInfo (
@@ -136,7 +159,10 @@ def fill_sequence_needs_broadcast(args_kwargs):
136
159
pil_kernel_info = PILKernelInfo (F .affine_image_pil ),
137
160
test_marks = [
138
161
xfail_dispatch_pil_if_fill_sequence_needs_broadcast ,
139
- xfail_python_scalar_arg_jit ("shear" ),
162
+ xfail_jit_python_scalar_arg ("shear" ),
163
+ xfail_jit_tuple_instead_of_list ("fill" ),
164
+ # TODO: check if this is a regression since it seems that should be supported if `int` is ok
165
+ xfail_jit_list_of_ints ("fill" ),
140
166
],
141
167
),
142
168
DispatcherInfo (
@@ -156,6 +182,11 @@ def fill_sequence_needs_broadcast(args_kwargs):
156
182
features .Mask : F .rotate_mask ,
157
183
},
158
184
pil_kernel_info = PILKernelInfo (F .rotate_image_pil ),
185
+ test_marks = [
186
+ xfail_jit_tuple_instead_of_list ("fill" ),
187
+ # TODO: check if this is a regression since it seems that should be supported if `int` is ok
188
+ xfail_jit_list_of_ints ("fill" ),
189
+ ],
159
190
),
160
191
DispatcherInfo (
161
192
F .crop ,
@@ -194,7 +225,12 @@ def fill_sequence_needs_broadcast(args_kwargs):
194
225
),
195
226
condition = lambda args_kwargs : fill_sequence_needs_broadcast (args_kwargs )
196
227
and args_kwargs .kwargs .get ("padding_mode" , "constant" ) == "constant" ,
197
- )
228
+ ),
229
+ xfail_jit_python_scalar_arg ("padding" ),
230
+ xfail_jit_tuple_instead_of_list ("padding" ),
231
+ xfail_jit_tuple_instead_of_list ("fill" ),
232
+ # TODO: check if this is a regression since it seems that should be supported if `int` is ok
233
+ xfail_jit_list_of_ints ("fill" ),
198
234
],
199
235
),
200
236
DispatcherInfo (
@@ -227,7 +263,7 @@ def fill_sequence_needs_broadcast(args_kwargs):
227
263
},
228
264
pil_kernel_info = PILKernelInfo (F .center_crop_image_pil ),
229
265
test_marks = [
230
- xfail_integer_size_jit ("output_size" ),
266
+ xfail_jit_integer_size ("output_size" ),
231
267
],
232
268
),
233
269
DispatcherInfo (
@@ -237,8 +273,8 @@ def fill_sequence_needs_broadcast(args_kwargs):
237
273
},
238
274
pil_kernel_info = PILKernelInfo (F .gaussian_blur_image_pil ),
239
275
test_marks = [
240
- xfail_python_scalar_arg_jit ("kernel_size" ),
241
- xfail_python_scalar_arg_jit ("sigma" ),
276
+ xfail_jit_python_scalar_arg ("kernel_size" ),
277
+ xfail_jit_python_scalar_arg ("sigma" ),
242
278
],
243
279
),
244
280
DispatcherInfo (
@@ -335,7 +371,7 @@ def fill_sequence_needs_broadcast(args_kwargs):
335
371
},
336
372
pil_kernel_info = PILKernelInfo (F .five_crop_image_pil ),
337
373
test_marks = [
338
- xfail_integer_size_jit (),
374
+ xfail_jit_integer_size (),
339
375
skip_dispatch_feature ,
340
376
],
341
377
),
@@ -345,7 +381,7 @@ def fill_sequence_needs_broadcast(args_kwargs):
345
381
features .Image : F .ten_crop_image_tensor ,
346
382
},
347
383
test_marks = [
348
- xfail_integer_size_jit (),
384
+ xfail_jit_integer_size (),
349
385
skip_dispatch_feature ,
350
386
],
351
387
pil_kernel_info = PILKernelInfo (F .ten_crop_image_pil ),
0 commit comments