-
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
make datapoint methods private #7733
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7733
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 58b8eba: NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
def _gaussian_blur(self, kernel_size: List[int], sigma: Optional[List[float]] = None) -> Datapoint: | ||
return self | ||
|
||
def _normalize(self, mean: List[float], std: List[float], inplace: bool = False) -> Datapoint: |
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 was missed in #7113. We technically don't need it, since both the dispatcher
vision/torchvision/transforms/v2/functional/_misc.py
Lines 65 to 70 in 08c9938
elif isinstance(inpt, (datapoints.Image, datapoints.Video)): | |
return inpt.normalize(mean=mean, std=std, inplace=inplace) | |
else: | |
raise TypeError( | |
f"Input can either be a plain tensor or an `Image` or `Video` datapoint, " f"but got {type(inpt)} instead." | |
) |
and the transform
vision/torchvision/transforms/v2/_misc.py
Line 162 in 08c9938
_transformed_types = (datapoints.Image, is_simple_tensor, datapoints.Video) |
filter on the datapoint type. However, this is the only dispatcher that does not have a method defined on the datapoint base class.
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 Philip, LGTM if green
I guess now we need an "official" way of supporting user-defined Datapoints. But we can start thinking about that later.
Superseded by #7747. |
Reasons:
Image(...).crop(...)
and might think this is normal way to do it.Datapoint.resize
, which overwritesTensor.resize
. However, there might be more of these in the future.