I believe this occurs when your image is mode = F (floating point) and thus only has a single channel. In this case color is expected to be a single number and not a tuple. Pytorch however sees floating point numbers and passes a tuple of one item downstream to color and hence the error from PIL. Not sure if it’s a bug or a feature.