Solved by martinr in post #2 
              
              
                For the first error looks like your data is already a PIL image, so ToPILImage fails. 
For the second error you forgot parenthesis. Instead of transforms.RandomHorizontalFlip,  transforms.RandomVerticalFlip try using transforms.RandomHorizontalFlip(),     transforms.RandomVerticalFlip()