Python Forum
AttributeError: module 'mnist' has no attribute 'train_images'
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: module 'mnist' has no attribute 'train_images'
#1
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?
Reply
#2
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],
........
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adapting mnist model with personal dataset GJG 0 877 Oct-09-2022, 02:38 PM
Last Post: GJG
  Create your own Mnist images (NNW, MNIST) stalfilip 1 1,873 Dec-25-2019, 08:27 AM
Last Post: scidam
  AttributeError: (“module 'pandas' has no attribute 'rolling_std'” Mariana136 4 7,558 Sep-23-2019, 12:56 PM
Last Post: Mariana136
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 45,278 May-29-2019, 02:48 AM
Last Post: heiner55
  Pandas to_csv in for loop AttributeError: 'tuple' object has no attribute 'to_csv' NSearch 9 16,765 Apr-22-2019, 05:05 PM
Last Post: Yoriz
  AttributeError: 'NoneType' object has no attribute 'all' synthex 2 5,209 Mar-07-2019, 11:11 AM
Last Post: synthex
  Please help with AttributeError: 'Netz' object has no attribute 'conv' DerBerliner 2 3,723 Feb-27-2019, 06:01 PM
Last Post: DerBerliner
  AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' DomClout 4 8,725 Jul-27-2018, 09:05 PM
Last Post: Vysero
  AttributeError: 'set' object has no attribute 'items hey_arnold 3 26,537 Apr-29-2018, 04:33 PM
Last Post: hey_arnold
  AttributeError: module 'plotly' has no attribute 'offline' charlesczc 8 16,999 Jan-21-2018, 08:34 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020