1
- import collections .abc
2
-
3
1
import pytest
4
2
import torchvision .transforms .v2 .functional as F
5
3
from torchvision import tv_tensors
@@ -112,32 +110,6 @@ def xfail_jit_python_scalar_arg(name, *, reason=None):
112
110
multi_crop_skips .append (skip_dispatch_tv_tensor )
113
111
114
112
115
- def xfails_pil (reason , * , condition = None ):
116
- return [
117
- TestMark (("TestDispatchers" , test_name ), pytest .mark .xfail (reason = reason ), condition = condition )
118
- for test_name in ["test_dispatch_pil" , "test_pil_output_type" ]
119
- ]
120
-
121
-
122
- def fill_sequence_needs_broadcast (args_kwargs ):
123
- (image_loader , * _ ), kwargs = args_kwargs
124
- try :
125
- fill = kwargs ["fill" ]
126
- except KeyError :
127
- return False
128
-
129
- if not isinstance (fill , collections .abc .Sequence ) or len (fill ) > 1 :
130
- return False
131
-
132
- return image_loader .num_channels > 1
133
-
134
-
135
- xfails_pil_if_fill_sequence_needs_broadcast = xfails_pil (
136
- "PIL kernel doesn't support sequences of length 1 for `fill` if the number of color channels is larger." ,
137
- condition = fill_sequence_needs_broadcast ,
138
- )
139
-
140
-
141
113
DISPATCHER_INFOS = [
142
114
DispatcherInfo (
143
115
F .resized_crop ,
@@ -159,14 +131,6 @@ def fill_sequence_needs_broadcast(args_kwargs):
159
131
},
160
132
pil_kernel_info = PILKernelInfo (F ._pad_image_pil , kernel_name = "pad_image_pil" ),
161
133
test_marks = [
162
- * xfails_pil (
163
- reason = (
164
- "PIL kernel doesn't support sequences of length 1 for argument `fill` and "
165
- "`padding_mode='constant'`, if the number of color channels is larger."
166
- ),
167
- condition = lambda args_kwargs : fill_sequence_needs_broadcast (args_kwargs )
168
- and args_kwargs .kwargs .get ("padding_mode" , "constant" ) == "constant" ,
169
- ),
170
134
xfail_jit ("F.pad only supports vector fills for list of floats" , condition = pad_xfail_jit_fill_condition ),
171
135
xfail_jit_python_scalar_arg ("padding" ),
172
136
],
@@ -181,7 +145,6 @@ def fill_sequence_needs_broadcast(args_kwargs):
181
145
},
182
146
pil_kernel_info = PILKernelInfo (F ._perspective_image_pil ),
183
147
test_marks = [
184
- * xfails_pil_if_fill_sequence_needs_broadcast ,
185
148
xfail_jit_python_scalar_arg ("fill" ),
186
149
],
187
150
),
0 commit comments