Skip to content
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

[BC-breaking] Fix for integer fill value in constant padding #2284

Merged
merged 3 commits into from Jun 4, 2020

Conversation

fmassa
Copy link
Member

@fmassa fmassa commented Jun 3, 2020

The previous implementation of pad with constant fill value had an undesired behavior when a single value was passed.

One would expect that it would fill the whole region with the (pad, pad, pad) value, but in fact it was doing (pad, 0, 0), as this is how Pillow handles it.

This is a backwards-incompatible change in torchvision that changes the behavior of the function, but given that most users use a value of 0, this shouldn't be a big issue.

@fmassa
Copy link
Member Author

fmassa commented Jun 3, 2020

@pmeier could you have a look to double-check?

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

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

Two minor issues but otherwise LGTM.

test/test_transforms.py Outdated Show resolved Hide resolved
torchvision/transforms/functional.py Show resolved Hide resolved
@fmassa fmassa merged commit 37a0d8d into pytorch:master Jun 4, 2020
@fmassa fmassa deleted the pad-bugfix branch June 4, 2020 15:47
@fmassa
Copy link
Member Author

fmassa commented Jun 4, 2020

Thanks for the review @pmeier !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants