Skip to content

Commit 01257d3

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] fix reference tests for convert_format_bounding_box (#6860)
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
1 parent 4beffea commit 01257d3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/prototype_transforms_kernel_infos.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,12 @@ def sample_inputs_convert_format_bounding_box():
536536

537537
def reference_convert_format_bounding_box(bounding_box, old_format, new_format):
538538
return torchvision.ops.box_convert(
539-
bounding_box, in_fmt=old_format.kernel_name.lower(), out_fmt=new_format.kernel_name.lower()
540-
)
539+
bounding_box, in_fmt=old_format.name.lower(), out_fmt=new_format.name.lower()
540+
).to(bounding_box.dtype)
541541

542542

543543
def reference_inputs_convert_format_bounding_box():
544-
for args_kwargs in sample_inputs_convert_color_space_image_tensor():
544+
for args_kwargs in sample_inputs_convert_format_bounding_box():
545545
if len(args_kwargs.args[0].shape) == 2:
546546
yield args_kwargs
547547

test/test_prototype_transforms_functional.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def script(fn):
3838

3939
def make_info_args_kwargs_params(info, *, args_kwargs_fn, test_id=None):
4040
args_kwargs = list(args_kwargs_fn(info))
41+
if not args_kwargs:
42+
raise pytest.UsageError(
43+
f"Couldn't collect a single `ArgsKwargs` for `{info.id}`{f' in {test_id}' if test_id else ''}"
44+
)
4145
idx_field_len = len(str(len(args_kwargs)))
4246
return [
4347
pytest.param(

0 commit comments

Comments
 (0)