@@ -364,13 +364,14 @@ def resize_keypoints(
364364 keypoints : torch .Tensor ,
365365 size : Optional [list [int ]],
366366 canvas_size : tuple [int , int ],
367- interpolation : Union [InterpolationMode , int ] = InterpolationMode .BILINEAR ,
368367 max_size : Optional [int ] = None ,
369- antialias : Optional [bool ] = True ,
370368):
371369 old_height , old_width = canvas_size
372370 new_height , new_width = _compute_resized_output_size (canvas_size , size = size , max_size = max_size )
373371
372+ if (new_height , new_width ) == (old_height , old_width ):
373+ return keypoints , canvas_size
374+
374375 w_ratio = new_width / old_width
375376 h_ratio = new_height / old_height
376377 ratios = torch .tensor ([w_ratio , h_ratio ], device = keypoints .device )
@@ -383,17 +384,13 @@ def resize_keypoints(
383384def _resize_keypoints_dispatch (
384385 keypoints : tv_tensors .KeyPoints ,
385386 size : Optional [list [int ]],
386- interpolation : Union [InterpolationMode , int ] = InterpolationMode .BILINEAR ,
387387 max_size : Optional [int ] = None ,
388- antialias : Optional [bool ] = True ,
389388) -> tv_tensors .KeyPoints :
390389 out , canvas_size = resize_keypoints (
391390 keypoints .as_subclass (torch .Tensor ),
392391 size ,
393392 canvas_size = keypoints .canvas_size ,
394- interpolation = interpolation ,
395393 max_size = max_size ,
396- antialias = antialias ,
397394 )
398395 return tv_tensors .wrap (out , like = keypoints , canvas_size = canvas_size )
399396
@@ -1259,8 +1256,10 @@ def rotate_keypoints(
12591256def _rotate_keypoints_dispatch (
12601257 inpt : tv_tensors .KeyPoints , angle : float , expand : bool = False , center : Optional [list [float ]] = None , ** kwargs
12611258) -> tv_tensors .KeyPoints :
1262- out , canvas_size = rotate_keypoints (inpt , canvas_size = inpt .canvas_size , angle = angle , center = center , expand = expand )
1263- return tv_tensors .wrap (out , like = inpt , canvas_size = canvas_size )
1259+ output , canvas_size = rotate_keypoints (
1260+ inpt , canvas_size = inpt .canvas_size , angle = angle , center = center , expand = expand
1261+ )
1262+ return tv_tensors .wrap (output , like = inpt , canvas_size = canvas_size )
12641263
12651264
12661265def rotate_bounding_boxes (
0 commit comments