PyTorch transformations change dimensions
I do not understand why pytorch transformations from 100x100 pic make 3x100 pic. 

print("Original shape ", x.shape)

x = transforms.Compose([
    transforms.ToPILImage(),
    transforms.ToTensor()
])(x)

print("After transformation shape ", x.shape)


outputs 

Original shape  torch.Size([100, 100, 3])
After transformation shape  torch.Size([3, 100, 3])


What is happening?

According to the docs https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.ToPILImage, if the input is a Torch tensor, the shape is C x H x W. So 100 is considered to be number of channels. Because there is no mode that corresponds to 100 channels, it interpreted as RGB (3 channels).

So you need input shape torch.Size([3, 100, 100]) to make it work as you want.
