I have been experimenting with a Keras example, which needs to import MNIST data
from keras.datasets import mnist
import numpy as np
(x_train, _), (x_test, _) =
Well, the keras.datasets.mnist
file is really short. You can manually simulate the same action, that is:
.
import gzip
f = gzip.open('mnist.pkl.gz', 'rb')
if sys.version_info < (3,):
data = cPickle.load(f)
else:
data = cPickle.load(f, encoding='bytes')
f.close()
(x_train, _), (x_test, _) = data