Solved by Nikronic in post #3 
              
              
                Hi, 
Here is the problem. MNIST object does not have transform and target_transform. You need to call dataset attribute of MNIST then call transform etc. 

Solution: 
dataset_valid.dataset.transform = transform
dataset_valid.dataset.target_transform = OneHot()

Bests