Skip to content

Commit 4001973

Browse files
committed
Nits, remove comments
1 parent 3db715a commit 4001973

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

test/test_transforms_v2.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# In the future, this global variable will be replaced with `list(tv_tensors.BoundingBoxFormat)`
6161
# to support all available formats.
6262
SUPPORTED_BOX_FORMATS = [tv_tensors.BoundingBoxFormat[x] for x in ["XYXY", "XYWH", "CXCYWH"]]
63-
NEW_BOX_FORMATS = [tv_tensors.BoundingBoxFormat[x] for x in ["XYWHR", "CXCYWHR", "XYXYXYXY"]] # XYXYR
63+
NEW_BOX_FORMATS = [tv_tensors.BoundingBoxFormat[x] for x in ["XYWHR", "CXCYWHR", "XYXYXYXY"]]
6464

6565
# turns all warnings into errors for this module
6666
pytestmark = [pytest.mark.filterwarnings("error")]
@@ -3553,7 +3553,9 @@ def test_kernel_inplace(self, old_format, new_format):
35533553
input, old_format=old_format, new_format=new_format, inplace=True
35543554
)
35553555
if old_format != tv_tensors.BoundingBoxFormat.XYXYXYXY and new_format != tv_tensors.BoundingBoxFormat.XYXYXYXY:
3556-
# NOTE: BoundingBox format conversion from and to XYXYXYXY format cannot modify the input tensor inplace as it requires a dimension change.
3556+
# NOTE: BoundingBox format conversion from and to XYXYXYXY format
3557+
# cannot modify the input tensor inplace as it requires a dimension
3558+
# change.
35573559
assert output_inplace.data_ptr() == input.data_ptr()
35583560
assert output_inplace._version > input_version
35593561
assert output_inplace is input
@@ -3615,10 +3617,7 @@ def test_correctness(self, old_format, new_format, dtype, device, fn_type):
36153617
actual = fn(bounding_boxes)
36163618
expected = self._reference_convert_bounding_box_format(bounding_boxes, new_format)
36173619

3618-
# try:
36193620
assert_equal(actual, expected)
3620-
# except:
3621-
# import pdb; pdb.set_trace()
36223621

36233622
def test_errors(self):
36243623
input_tv_tensor = make_bounding_boxes()

torchvision/transforms/v2/functional/_meta.py

-4
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ def _convert_bounding_box_format(
278278
elif old_format == BoundingBoxFormat.CXCYWHR:
279279
bounding_boxes = _cxcywhr_to_xywhr(bounding_boxes, inplace)
280280
elif old_format == BoundingBoxFormat.XYXYXYXY:
281-
# bounding_boxes = _xyxyxyxy_to_cxcywhr(bounding_boxes, inplace)
282-
# bounding_boxes = _cxcywhr_to_xywhr(bounding_boxes, inplace)
283281
bounding_boxes = _xyxyxyxy_to_xywhr(bounding_boxes, inplace)
284282

285283
if new_format == BoundingBoxFormat.XYWH:
@@ -289,8 +287,6 @@ def _convert_bounding_box_format(
289287
elif new_format == BoundingBoxFormat.CXCYWHR:
290288
bounding_boxes = _xywhr_to_cxcywhr(bounding_boxes, inplace)
291289
elif new_format == BoundingBoxFormat.XYXYXYXY:
292-
# bounding_boxes = _xywhr_to_cxcywhr(bounding_boxes, inplace)
293-
# bounding_boxes = _cxcywhr_to_xyxyxyxy(bounding_boxes, inplace)
294290
bounding_boxes = _xywhr_to_xyxyxyxy(bounding_boxes, inplace)
295291

296292
return bounding_boxes

0 commit comments

Comments
 (0)