title: MNIST object has no attribute data
body: <p>I am trying to run the piece of code given below but unfortunately I get the following error- "MNIST object has no attribute data". The error is because of the line "mnist_train_set.data.view(-1, 1, 28, 28).float()". Can someone shed some light on how to fix this? Thanks. </p>
  
  <pre class="lang-py prettyprint-override"><code>import torch
  from torchvision import datasets
  
  ...
  
  mnist_train_set = datasets.MNIST(data_dir + '/mnist/', train = True, download = True)
  mnist_test_set = datasets.MNIST(data_dir + '/mnist/', train = False, download = True)
  
  train_input = mnist_train_set.data.view(-1, 1, 28, 28).float()
  train_target = mnist_train_set.targets
  test_input = mnist_test_set.data.view(-1, 1, 28, 28).float()
  test_target = mnist_test_set.targets
  </code></pre>