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

Add support in transforms.ToTensor for PIL Images mod '1' #471

Merged
merged 3 commits into from
Apr 16, 2018

Conversation

arturml
Copy link
Contributor

@arturml arturml commented Apr 14, 2018

Pil images mode '1' are 1-bit, so this line didn't work:

img = torch.ByteTensor(torch.ByteStorage.from_buffer(pic.tobytes()))

I added another if to handle mode '1' images and added a test case in test_transforms.py

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

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

Hi,

Thanks for the PR!

The CI is currently broken (but should be fixed with #472), but I see that lint is failing. Could you fix pep8 issues?

@fmassa fmassa merged commit f6ab107 into pytorch:master Apr 16, 2018
@arturml arturml deleted the ToTensor_mode1 branch April 22, 2018 01:31
varunagrawal pushed a commit to varunagrawal/vision that referenced this pull request Jul 23, 2018
* Add case in test_to_tensor for PIL Images mode '1'

* Add support in ToTensor for PIL Images mode '1'

* Fix pep8 issues
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.

2 participants