-
Notifications
You must be signed in to change notification settings - Fork 7k
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
fix reference tests for convert_format_bounding_box #6860
Conversation
|
||
|
||
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(): |
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.
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.
@@ -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() |
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.
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) |
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.
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
.
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.
Thanks!
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 ''}" | ||
) |
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.
This makes sure this doesn't happen again in the future.
Summary: * fix reference tests for convert_format_bounding_box * add check to prevent empty args_kwargs_fns in the future Reviewed By: datumbox Differential Revision: D40851025 fbshipit-source-id: 5b95c2e3c2bf858edd79916b74fc529ec8ed7424
Without this, the reference tests for
convert_format_bounding_box
were not run at all.cc @vfdev-5 @datumbox @bjuncek