-
Notifications
You must be signed in to change notification settings - Fork 7.2k
fix reference tests for convert_format_bounding_box #6860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() | ||
| ).to(bounding_box.dtype) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
|
|
||
| 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(): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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( | ||
|
|
||
There was a problem hiding this comment.
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.