You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially, torchvision supported int's for the interpolation (or their former equivalent) arguments on our transforms. They were usually not passed directly, but rather as part of the Pillow constants, like PIL.Image.BILINEAR.
#2952 (review) proposed to decouple our transforms from Pillow and this was achieved through the torchvision.transforms.InterpolationMode enum introduced later in the same PR. Although, the new enum was used as default value from then on, int's were still supported. Still, the language around them somewhat "soft-deprecated" them:
For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
With the release of Pillow==9.1.0, they deprecated the int constants and switched to their own enums as well. In response we introduced support for these enums as well in #5898 and deprecated ints in #5974.
Our deprecation was scheduled for removal in the upcoming 0.15 release and was acted upon in #7176.
However, there are two factors we didn't consider there:
@NicolasHug pointed out that using ints is still widespread for Meta internal users
Given that our deprecation just followed Pillow's, I think we can also revert the removal and deprecation. Between >= 9.1.0 and < 9.4.0, Pillow never dropped support for int's. Thus, the only issues our users could run into when using int's on that versions is that Pillow will emit a deprecation warning. Our default values use our enum anyway
If we go that route note that we also need add support for int's to our prototype transforms. They don't have that, since we designed with the scheduled removal in mind.
Thanks for digging the history here Philip.
I'm happy to go for the least disruptive change and put back support for PIL.Image int constants. Since they're here to stay (according to the issue/PR on the PIL repo), we can also remove our warning encouraging users to use our own InterpolationMode.
If we go that route note that we also need add support for int's to our prototype transforms
Good point - although considering how tight our deadline is, I would be fine with leaving that for after the release if we have to (if we can do it before, it's even better, but not a blocker)
Uh oh!
There was an error while loading. Please reload this page.
Initially,
torchvision
supportedint
's for theinterpolation
(or their former equivalent) arguments on our transforms. They were usually not passed directly, but rather as part of the Pillow constants, likePIL.Image.BILINEAR
.#2952 (review) proposed to decouple our transforms from Pillow and this was achieved through the
torchvision.transforms.InterpolationMode
enum introduced later in the same PR. Although, the new enum was used as default value from then on,int
's were still supported. Still, the language around them somewhat "soft-deprecated" them:vision/torchvision/transforms/transforms.py
Line 301 in 9b5a3fe
With the release of
Pillow==9.1.0
, they deprecated theint
constants and switched to their own enums as well. In response we introduced support for these enums as well in #5898 and deprecatedint
s in #5974.Our deprecation was scheduled for removal in the upcoming 0.15 release and was acted upon in #7176.
However, there are two factors we didn't consider there:
@NicolasHug pointed out that using ints is still widespread for Meta internal users
Pillow
seemed to have walked back on their deprecation in9.4.0
as well:This follows API changes for Resampling modes python-pillow/Pillow#6537 which acknowledges that the change is too disruptive. However, since removing the enums now would also be BC breaking (Revert replacing and deprecating constants with enums python-pillow/Pillow#6684), they just reinstated the former int constants in python-pillow/Pillow@bcdb208
Given that our deprecation just followed
Pillow
's, I think we can also revert the removal and deprecation. Between>= 9.1.0
and< 9.4.0
,Pillow
never dropped support forint
's. Thus, the only issues our users could run into when usingint
's on that versions is thatPillow
will emit a deprecation warning. Our default values use our enum anywayvision/torchvision/transforms/transforms.py
Line 315 in 539c6e2
If we go that route note that we also need add support for
int
's to our prototype transforms. They don't have that, since we designed with the scheduled removal in mind.Thoughts?
cc @vfdev-5
The text was updated successfully, but these errors were encountered: