@@ -115,8 +115,9 @@ def resize_image_tensor(
115115 size : List [int ],
116116 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
117117 max_size : Optional [int ] = None ,
118- antialias : bool = False ,
118+ antialias : Optional [ bool ] = None ,
119119) -> torch .Tensor :
120+ antialias = False if antialias is None else antialias
120121 align_corners : Optional [bool ] = None
121122 if interpolation == InterpolationMode .BILINEAR or interpolation == InterpolationMode .BICUBIC :
122123 align_corners = False
@@ -196,7 +197,7 @@ def resize_video(
196197 size : List [int ],
197198 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
198199 max_size : Optional [int ] = None ,
199- antialias : bool = False ,
200+ antialias : Optional [ bool ] = None ,
200201) -> torch .Tensor :
201202 return resize_image_tensor (video , size = size , interpolation = interpolation , max_size = max_size , antialias = antialias )
202203
@@ -209,10 +210,8 @@ def resize(
209210 antialias : Optional [bool ] = None ,
210211) -> features .InputTypeJIT :
211212 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
213213 return resize_image_tensor (inpt , size , interpolation = interpolation , max_size = max_size , antialias = antialias )
214214 elif isinstance (inpt , features ._Feature ):
215- antialias = False if antialias is None else antialias
216215 return inpt .resize (size , interpolation = interpolation , max_size = max_size , antialias = antialias )
217216 else :
218217 if antialias is not None and not antialias :
@@ -1396,7 +1395,7 @@ def resized_crop_image_tensor(
13961395 width : int ,
13971396 size : List [int ],
13981397 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
1399- antialias : bool = False ,
1398+ antialias : Optional [ bool ] = None ,
14001399) -> torch .Tensor :
14011400 image = crop_image_tensor (image , top , left , height , width )
14021401 return resize_image_tensor (image , size , interpolation = interpolation , antialias = antialias )
@@ -1449,7 +1448,7 @@ def resized_crop_video(
14491448 width : int ,
14501449 size : List [int ],
14511450 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
1452- antialias : bool = False ,
1451+ antialias : Optional [ bool ] = None ,
14531452) -> torch .Tensor :
14541453 return resized_crop_image_tensor (
14551454 video , top , left , height , width , antialias = antialias , size = size , interpolation = interpolation
@@ -1467,12 +1466,10 @@ def resized_crop(
14671466 antialias : Optional [bool ] = None ,
14681467) -> features .InputTypeJIT :
14691468 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
14711469 return resized_crop_image_tensor (
14721470 inpt , top , left , height , width , antialias = antialias , size = size , interpolation = interpolation
14731471 )
14741472 elif isinstance (inpt , features ._Feature ):
1475- antialias = False if antialias is None else antialias
14761473 return inpt .resized_crop (top , left , height , width , antialias = antialias , size = size , interpolation = interpolation )
14771474 else :
14781475 return resized_crop_image_pil (inpt , top , left , height , width , size = size , interpolation = interpolation )
0 commit comments