Skip to content

Refactor test BoxOps #4596

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

Closed

Conversation

Chandan-h-509
Copy link

Fixes #4500

@facebook-github-bot
Copy link

Hi @Chandan-h-509!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Chandan-h-509 ,

I think that the parametrization that @fmassa had in mind originally is a bit different from what is proposed here. Instead of parametrizating over the int and float values, I think the goal is rather to parametrize over the box creation functions, the expected values, etc.

Essentially we would only have one single class like

@pytest.mark.parametrize('box_fn, box_tensor, expected_values', (
    (ops.box_area, <the_box_tensor_here>, <the_expected_values_here>)
    (ops.box_iou, <the_box_tensor_here>, <the_expected_values_here>)
    (ops.generalized_box_iou, <the_box_tensor_here>, <the_expected_values_here>)
)
class TestBox:
...

With potentially other parameters as needed

Does that make sense?

Comment on lines +1000 to +1001
@pytest.mark.parametrize("int_dtype", [torch.int8, torch.int16, torch.int32, torch.int64])
@pytest.mark.parametrize("float_dtype", [torch.float32, torch.float64])
Copy link
Member

Choose a reason for hiding this comment

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

As explained above I think this isn't the parametrization we're looking for, but just a note: this parametrization here will make a cross-product over the int values and the float values, equivalent to this:

for int_dtype in int_values:
    for float_dtype in float_values:
        the_test_body_here()

So this isn't equivalent to the previous tests, which looked like this:

for int_dtype in int_values:
    do_something;
for float_dtype in float_values:
    do_something_else()

@Chandan-h-509
Copy link
Author

Thanks for the PR @Chandan-h-509 ,

I think that the parametrization that @fmassa had in mind originally is a bit different from what is proposed here. Instead of parametrizating over the int and float values, I think the goal is rather to parametrize over the box creation functions, the expected values, etc.

Essentially we would only have one single class like

@pytest.mark.parametrize('box_fn, box_tensor, expected_values', (
    (ops.box_area, <the_box_tensor_here>, <the_expected_values_here>)
    (ops.box_iou, <the_box_tensor_here>, <the_expected_values_here>)
    (ops.generalized_box_iou, <the_box_tensor_here>, <the_expected_values_here>)
)
class TestBox:
...

With potentially other parameters as needed

Does that make sense?

ohk. I will do the necessary changes
_

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@datumbox datumbox requested a review from fmassa November 2, 2021 13:43
@datumbox
Copy link
Contributor

datumbox commented Jan 5, 2022

@Chandan-h-509 Happy new year. Do you plan to complete the PR or should we place the issue "up for grabs" for other contributors? Let us know, thanks!

@datumbox
Copy link
Contributor

Due to inactivity I'll place the ticket as "up for grabs". Ping me if you want to pick it up again. Thanks!

@datumbox datumbox closed this Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor BoxOps tests to use parameterize
4 participants