Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/prototype_transforms_kernel_infos.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,12 @@ def sample_inputs_convert_format_bounding_box():

def reference_convert_format_bounding_box(bounding_box, old_format, new_format):
return torchvision.ops.box_convert(
bounding_box, in_fmt=old_format.kernel_name.lower(), out_fmt=new_format.kernel_name.lower()
)
bounding_box, in_fmt=old_format.name.lower(), out_fmt=new_format.name.lower()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These crept in during some auto-renaming, but were never caught since the test hasn't been run in the first place.

).to(bounding_box.dtype)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this because the reference does not convert back to the original dtype. Thus, if we put in integer boxes, we might get floating point boxes out, which might have a value of .5.



def reference_inputs_convert_format_bounding_box():
for args_kwargs in sample_inputs_convert_color_space_image_tensor():
for args_kwargs in sample_inputs_convert_format_bounding_box():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the root cause. We are iterating over images and below checking for only two dimensions. Since no such images exist in the sample function, we never yielded and therefore never saw an error.

if len(args_kwargs.args[0].shape) == 2:
yield args_kwargs

Expand Down
4 changes: 4 additions & 0 deletions test/test_prototype_transforms_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def script(fn):

def make_info_args_kwargs_params(info, *, args_kwargs_fn, test_id=None):
args_kwargs = list(args_kwargs_fn(info))
if not args_kwargs:
raise pytest.UsageError(
f"Couldn't collect a single `ArgsKwargs` for `{info.id}`{f' in {test_id}' if test_id else ''}"
)
Comment on lines +41 to +44
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure this doesn't happen again in the future.

idx_field_len = len(str(len(args_kwargs)))
return [
pytest.param(
Expand Down