How do I separate the input and targets from Pytorch Fashion MNIST?
The Fashion MNIST dataset is implemented pretty weirdly in Pytorch. I want to do something like:

X, y = FashionMNIST


But in reality, it's a little more complicated. This is what I have:

from torchvision.datasets import FashionMNIST
train = FashionMNIST(root='.', download=True, train=True)
print(train)


The output:

Dataset FashionMNIST
    Number of datapoints: 60000
    Root location: c:/users/nicolas/documents/data/fashionmnist
    Split: Train


What one observation looks like:

print(train[0])


(&lt;PIL.Image.Image image mode=L size=28x28 at 0x20868074780&gt;, 9)


I could only do it for one observation.

X, y = train[0]


So how do I separate the input and targets?

FashionMNIST object has data and targets attributes.

You can simply write 

X, y = train.data, train.targets


and then you can see the shapes

X.shape, y.shape



  (torch.Size([60000, 28, 28]), torch.Size([60000]))

