Skip to content

Conversation

@datumbox
Copy link
Contributor

@datumbox datumbox commented Nov 10, 2022

Though the support of accimage is somehow in limbo, we've previously (see #5545) fixed issues related to estimating the number of channels by removing the hardcoded getbands() call.

While scanning the codebase for improvements for Transforms V2, I noticed that the stable methods to_tensor() and pil_to_tensor() had still two cases where they estimated the channels directly from getbands(). This PR replaces those two calls with get_image_num_channels() which is able to handle the various PIL variants.

cc @vfdev-5

Copy link
Contributor

@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.

Thanks Vasilis!

@datumbox datumbox merged commit 98f1a40 into pytorch:main Nov 10, 2022
@datumbox datumbox deleted the transforms/accimage_fix branch November 10, 2022 13:41
facebook-github-bot pushed a commit that referenced this pull request Nov 14, 2022
Reviewed By: NicolasHug

Differential Revision: D41265203

fbshipit-source-id: 082a28ef8f8809e313c2ecf014ea156c943adb92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants