-
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
Remove _wrap()
class method from base class Datapoint
#7805
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7805
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New FailuresAs of commit 6237f0d: NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
_wrap()
class method from base class Datapoint
def test_no_wrapping_exceptions_with_metadata(): | ||
# Sanity checks for the ops in _NO_WRAPPING_EXCEPTIONS and datapoints with metadata |
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.
If you're wondering why I added this test, it's because I originally had changed the _NO_WRAPPING_EXCEPTIONS
to return output.as_subclass(cls)
instead of cls.wrap_like(input, output)
, and I didn't get a proper error in the tests. The only tests that were failing here were test_deepcopy()
which was failing on print(bbox)
, which is a bit too "remote" of a test.
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.
LGTM if CI is green. Thanks!
@@ -42,7 +42,9 @@ class BoundingBoxes(Datapoint): | |||
canvas_size: Tuple[int, int] | |||
|
|||
@classmethod | |||
def _wrap(cls, tensor: torch.Tensor, *, format: BoundingBoxFormat, canvas_size: Tuple[int, int]) -> BoundingBoxes: # type: ignore[override] | |||
def _wrap(cls, tensor: torch.Tensor, *, format: Union[BoundingBoxFormat, str], canvas_size: Tuple[int, int]) -> BoundingBoxes: # type: ignore[override] |
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.
Since Datapoint._wrap
is removed now, do we still need the mypy directive?
def _wrap(cls, tensor: torch.Tensor, *, format: Union[BoundingBoxFormat, str], canvas_size: Tuple[int, int]) -> BoundingBoxes: # type: ignore[override] | |
def _wrap(cls, tensor: torch.Tensor, *, format: Union[BoundingBoxFormat, str], canvas_size: Tuple[int, int]) -> BoundingBoxes: |
Reviewed By: matteobettini Differential Revision: D48642288 fbshipit-source-id: cce9803e2a4478afcbf56b052ff1ae39e1dc0b2d
Towards #7803
This mostly just removes
_wrap()
from the base class.Also minor cleanup of bbox code + some test.
cc @vfdev-5