@@ -115,8 +115,9 @@ def resize_image_tensor(
115
115
size : List [int ],
116
116
interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
117
117
max_size : Optional [int ] = None ,
118
- antialias : bool = False ,
118
+ antialias : Optional [ bool ] = None ,
119
119
) -> torch .Tensor :
120
+ antialias = False if antialias is None else antialias
120
121
align_corners : Optional [bool ] = None
121
122
if interpolation == InterpolationMode .BILINEAR or interpolation == InterpolationMode .BICUBIC :
122
123
align_corners = False
@@ -196,7 +197,7 @@ def resize_video(
196
197
size : List [int ],
197
198
interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
198
199
max_size : Optional [int ] = None ,
199
- antialias : bool = False ,
200
+ antialias : Optional [ bool ] = None ,
200
201
) -> torch .Tensor :
201
202
return resize_image_tensor (video , size = size , interpolation = interpolation , max_size = max_size , antialias = antialias )
202
203
@@ -209,10 +210,8 @@ def resize(
209
210
antialias : Optional [bool ] = None ,
210
211
) -> features .InputTypeJIT :
211
212
if isinstance (inpt , torch .Tensor ) and (torch .jit .is_scripting () or not isinstance (inpt , features ._Feature )):
212
- antialias = False if antialias is None else antialias
213
213
return resize_image_tensor (inpt , size , interpolation = interpolation , max_size = max_size , antialias = antialias )
214
214
elif isinstance (inpt , features ._Feature ):
215
- antialias = False if antialias is None else antialias
216
215
return inpt .resize (size , interpolation = interpolation , max_size = max_size , antialias = antialias )
217
216
else :
218
217
if antialias is not None and not antialias :
@@ -1396,7 +1395,7 @@ def resized_crop_image_tensor(
1396
1395
width : int ,
1397
1396
size : List [int ],
1398
1397
interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
1399
- antialias : bool = False ,
1398
+ antialias : Optional [ bool ] = None ,
1400
1399
) -> torch .Tensor :
1401
1400
image = crop_image_tensor (image , top , left , height , width )
1402
1401
return resize_image_tensor (image , size , interpolation = interpolation , antialias = antialias )
@@ -1449,7 +1448,7 @@ def resized_crop_video(
1449
1448
width : int ,
1450
1449
size : List [int ],
1451
1450
interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
1452
- antialias : bool = False ,
1451
+ antialias : Optional [ bool ] = None ,
1453
1452
) -> torch .Tensor :
1454
1453
return resized_crop_image_tensor (
1455
1454
video , top , left , height , width , antialias = antialias , size = size , interpolation = interpolation
@@ -1467,12 +1466,10 @@ def resized_crop(
1467
1466
antialias : Optional [bool ] = None ,
1468
1467
) -> features .InputTypeJIT :
1469
1468
if isinstance (inpt , torch .Tensor ) and (torch .jit .is_scripting () or not isinstance (inpt , features ._Feature )):
1470
- antialias = False if antialias is None else antialias
1471
1469
return resized_crop_image_tensor (
1472
1470
inpt , top , left , height , width , antialias = antialias , size = size , interpolation = interpolation
1473
1471
)
1474
1472
elif isinstance (inpt , features ._Feature ):
1475
- antialias = False if antialias is None else antialias
1476
1473
return inpt .resized_crop (top , left , height , width , antialias = antialias , size = size , interpolation = interpolation )
1477
1474
else :
1478
1475
return resized_crop_image_pil (inpt , top , left , height , width , size = size , interpolation = interpolation )
0 commit comments