Skip to content

Commit e24a03f

Browse files
fix type error
Summary: Fixing error `TypeError: unsupported operand type(s) for |: 'type' and 'type'`
1 parent d7e8492 commit e24a03f

File tree

1 file changed

+3
-3
lines changed
  • torchvision/transforms/v2/functional

1 file changed

+3
-3
lines changed

torchvision/transforms/v2/functional/_misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import math
2-
from typing import Optional
2+
from typing import Optional, Union
33

44
import PIL.Image
55
import torch
@@ -448,7 +448,7 @@ def sanitize_keypoints(
448448
key_points: torch.Tensor,
449449
canvas_size: Optional[tuple[int, int]] = None,
450450
min_valid_edge_distance: int = 0,
451-
min_invalid_points: int | float = 1,
451+
min_invalid_points: Union[int, float] = 1,
452452
) -> tuple[torch.Tensor, torch.Tensor]:
453453
"""Remove keypoints outside of the image area and their corresponding labels (if any).
454454
@@ -527,7 +527,7 @@ def _get_sanitize_keypoints_mask(
527527
key_points: torch.Tensor,
528528
canvas_size: tuple[int, int],
529529
min_valid_edge_distance: int = 0,
530-
min_invalid_points: int | float = 1,
530+
min_invalid_points: Union[int, float] = 1,
531531
) -> torch.Tensor:
532532

533533
image_h, image_w = canvas_size

0 commit comments

Comments
 (0)