Solved by Nikronic in post #4 
              
              
                No, that was my mistake, remove ToPILImage from transfroms list and it will be ok. 

The explanation would be that ImageFolder converts to PIL by itself and ToPIL was converting a PIL image to PIL which is wrong as `ToPIL only needs tensor.