Skip to content

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