-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Reduce sample inputs for prototype transform kernels #6714
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
Conversation
@@ -63,17 +63,40 @@ def sample_inputs(self, *feature_types, filter_metadata=True): | |||
yield args_kwargs | |||
|
|||
|
|||
def xfail_python_scalar_arg_jit(name, *, reason=None): | |||
def xfail_jit_python_scalar_arg(name, *, reason=None): |
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.
Just a rename that moves the jit
term to the front of the name to make it clear this is only a JIT issue.
# TODO: check if this is a regression since it seems that should be supported if `int` is ok | ||
xfail_jit_list_of_ints("fill"), |
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 have a few of these. I'm not sure if this is a regression of #6636. Will check and send a follow-up PR since this is one is only test changes.
@@ -755,12 +755,7 @@ def gaussian_blur(img: Tensor, kernel_size: List[int], sigma: List[float]) -> Te | |||
kernel = _get_gaussian_kernel2d(kernel_size, sigma, dtype=dtype, device=img.device) | |||
kernel = kernel.expand(img.shape[-3], 1, kernel.shape[0], kernel.shape[1]) | |||
|
|||
img, need_cast, need_squeeze, out_dtype = _cast_squeeze_in( |
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.
Just a formatting change like #5880 that I saw while going through the kernels.
@@ -194,7 +225,12 @@ def fill_sequence_needs_broadcast(args_kwargs): | |||
), | |||
condition=lambda args_kwargs: fill_sequence_needs_broadcast(args_kwargs) | |||
and args_kwargs.kwargs.get("padding_mode", "constant") == "constant", | |||
) | |||
), | |||
xfail_jit_python_scalar_arg("padding"), |
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.
I wonder why all this xfail appeared in this PR and not before ?
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.
Because we didn't test scalar padding before
padding=[[1], [1, 1], [1, 1, 2, 2]], |
Thus, while reducing the number of sample inputs now, the tests are actually more comprehensive.
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 @pmeier !
Summary: * pad_image_tensor * pad_mask and pad_bounding_box * resize_{image_tensor, mask, bounding_box} * center_crop_{image_tensor, mask} * {five, ten}_crop_image_tensor * crop_{image_tensor, mask} * convert_color_space_image_tensor * affine_{image_tensor, mask, bounding_box} * rotate_{image_tensor, mask} * gaussian_blur_image_tensor * cleanup Reviewed By: NicolasHug Differential Revision: D40427478 fbshipit-source-id: 4954886d7d0b8212ea92847b07092a8dfad809cb
Addresses 3. from #6622.
This PR achieves a significant reduction of the number of sample inputs. Only for the bounding box kernels, the number goes up slightly. After manual inspection, it became clear that our previous sample inputs were not sufficient.
main
pad_image_tensor
resize_image_tensor
pad_mask
center_crop_image_tensor
resize_mask
center_crop_mask
affine_image_tensor
ten_crop_image_tensor
rotate_image_tensor
crop_image_tensor
affine_mask
convert_color_space_image_tensor
crop_mask
gaussian_blur_image_tensor
affine_bounding_box
five_crop_image_tensor
pad_bounding_box
rotate_mask
resize_bounding_box
In total we cut the number of tests (and approximately the runtime) roughly to a third of what is was before. Plus, we even increase the coverage ever so slightly:
main
: