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.
Initially,
torchvisionsupportedint'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.InterpolationModeenum 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 theintconstants and switched to their own enums as well. In response we introduced support for these enums as well in #5898 and deprecatedints 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
Pillowseemed to have walked back on their deprecation in9.4.0as 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.0and< 9.4.0,Pillownever dropped support forint's. Thus, the only issues our users could run into when usingint's on that versions is thatPillowwill 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