-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Minor fix antialias arg #6209
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
Closed
Minor fix antialias arg #6209
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this is a BC-breaking change for users who explicitly passed
antialias=None
, or similar patterns.Considering the relatively low benefit of removing support for
None
, we might want to keep it to avoid any potential issues?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 is private API which is not intended to be used by users. I keep public
resize
same but just changing private method.EDIT:
Main purpose is to drop None option from
resize_image_tensor
:If we want to keep private resize API unchanged, I think we can still update
resize_image_tensor
.@NicolasHug let me know what you think, please
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 function is importable without a leading underscore as
and as a result, it is likely that most users will consider it public, as this is a widely used convention throughout the pydata ecosystem.
I think it's fine to modify the prototype, but I'd rather keep the stable area untouched to avoid any potential breakage. Especially considering the low benefit, and the fact that these transforms will eventually be superseded by the prototype ones.
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.
Yeah, we should have added leading underscore to them. It very unfortunate if people today rely on this undocumented API. In this PR #3200 we removed "PRIVATE METHOD" in the docstring.
Previously I already refactored and removed an arg from
resize
method infunctional_pil
andfunctional_tensor
#6191 .Should we restore the arg for BC and warn about new behaviour ?
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.
Sorry just realized this is a public function, thanks @NicolasHug for noticing.
I agree that we shouldn't make BC changes in this case.
Looking at the update of @vfdev-5 comment, I think
resize_image_tensor
is under prototype which should be okay to change explicitly, but lets keep functional_tensor.resize unchanged.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.
Sorry what do you mean? We should treat everything in
functional_tensor
andfunctional_pil
as publicThere 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.
@NicolasHug this API is not public and the decision to do this has happened I believe 1.5 year ago. I am happy to chat more once we are both back.
Cc @fmassa who could provide more details as he made the decision
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 found some useful references. The last version that contained warnings that these are private APIs was 0.8: https://github.com/pytorch/vision/blob/release/0.8.0/torchvision/transforms/functional_tensor.py
After that the decision was made to remove the documentation warning, as back then that was the deprecation process followed.
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.
Decision was very quick: #3069 (review) and #3200 and here is your issue #3071 to do that
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.
As mentioned in #6191 (comment) there is absolutely nothing that shows that this API is private, unfortunately.
It is strictly the same as what's in
transforms.functional
. The only difference is the existence of docstrings, which isn't a reasonable frontier marker considering how users can discover APIs (through blogs, through auto-completion, etc).I do understand that this is unfortunate, but we've had various issues in the past where users had assumed that some APIs where public when we meant them to be private. A recent example is #5836 where we eventually had to reinstate BC through deprecation. This causes more frustration for our users, and more work for us.
We should also note that
functional_pil
in particular may be used by some users as a compatibility layer for torch and pil - as you know HF has shown interest in this recently. They might not be the only ones.Is there a very strong reason to break BC here? It looks like maintaining BC could be done at very little cost both in this PR and in #6191.