If you’re working with CIFAR pytorch has prebuilt datasets:
http://pytorch.org/docs/0.3.0/torchvision/datasets.html#cifar 6
And you can preprocess them with transforms, pytorch provides sevaral useful ones: http://pytorch.org/docs/0.3.0/torchvision/transforms.html 6 or you could always build your own transforms