I am following a machine learning video on youtube at https://www.youtube.com/watch?v=lbFEZAXzk0g. The tutorial is in python2 so I need to convert it into python3. Here is the section of the code I am having an error with:
def load_mnist_images(filename):
if not os.path.exists(filename):
download(filename)
with gzip.open(filename,'rb') as file:
data = numpy.frombuffer(file.read(),numpy.uint8, offset=16)
data = data.reshape(-1,1,28,28)
return data/numpy.float32(256)
I am getting this error:
ValueError: cannot reshape array of size 9992 into shape (1,28,28).
How do I fix this? In the tutorial it was working. Also, if I have any other errors please tell me.