Python Forum

Full Version: AttributeError: module 'mnist' has no attribute 'train_images'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I got this error: AttributeError: module 'mnist' has no attribute 'train_images'
when I ran this code:
import mnist
import itertools
import numpy as np

def prepare_data(images, labels):
    images = map(lambda a: a / 255.0, map(np.asarray, map(list, map(itertools.chain.from_iterable, images))))
    return list(zip(images, labels))

train = prepare_data(mnist.train_images(), mnist.train_labels())
test = prepare_data(mnist.test_images(), mnist.test_labels())
Can you please help me?
Look if you have named a file mnist.py.
>>> import mnist

>>> mnist.train_images
<function train_images at 0x0000013ACA59E7B8>

>>> mnist.train_images()
array([[[0, 0, 0, ..., 0, 0, 0],
........