Skip to content

Commit 49962b5

Browse files
add code inline
1 parent ed95753 commit 49962b5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

torchvision/tv_tensors/_bounding_boxes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ def _wrap(cls, tensor: torch.Tensor, *, format: BoundingBoxFormat | str, canvas_
9999
bounding_boxes.clamping_mode = clamping_mode
100100
return bounding_boxes
101101

102-
@staticmethod
103-
def _check_format(tensor: torch.Tensor, format: BoundingBoxFormat) -> None:
104-
if not torch.is_floating_point(tensor) and is_rotated_bounding_format(format):
105-
raise ValueError("Rotated bounding boxes should be floating point tensors")
106-
107102
def __new__(
108103
cls,
109104
data: Any,
@@ -116,7 +111,8 @@ def __new__(
116111
requires_grad: bool | None = None,
117112
) -> BoundingBoxes:
118113
tensor = cls._to_tensor(data, dtype=dtype, device=device, requires_grad=requires_grad)
119-
cls._check_format(tensor, format=format)
114+
if not torch.is_floating_point(tensor) and is_rotated_bounding_format(format):
115+
raise ValueError("Rotated bounding boxes should be floating point tensors")
120116
return cls._wrap(tensor, format=format, canvas_size=canvas_size, clamping_mode=clamping_mode)
121117

122118
@classmethod

0 commit comments

Comments
 (0)