【问题标题】:Theano AttributeError: 'module' object has no attribute 'tests'Theano AttributeError:“模块”对象没有属性“测试”
【发布时间】:2017-08-01 23:58:25
【问题描述】:

我用 Theano 后端安装了 Keras,它运行良好,但在导入 keras 时突然出现以下错误:

    Using Theano backend.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-570b835f182b> in <module>()
      1 # import keras
----> 2 from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
      3 from keras.models import Sequential
      4 from keras.layers import Convolution2D, MaxPooling2D
      5 from keras.layers import Activation, Dropout, Flatten, Dense

/home/pjwstk.edu.pl/s16352/python/keras/keras/__init__.py in <module>()
      1 from __future__ import absolute_import
----> 2 from . import backend
      3 from . import datasets
      4 from . import engine
      5 from . import layers

/home/pjwstk.edu.pl/s16352/python/keras/keras/backend/__init__.py in <module>()
     62 if _BACKEND == 'theano':
     63     sys.stderr.write('Using Theano backend.\n')
---> 64     from .theano_backend import *
     65 elif _BACKEND == 'tensorflow':
     66     sys.stderr.write('Using TensorFlow backend.\n')

/home/pjwstk.edu.pl/s16352/python/keras/keras/backend/theano_backend.py in <module>()
----> 1 import theano
      2 from theano import tensor as T
      3 from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
      4 from theano.tensor.signal import pool
      5 from theano.tensor.nnet import conv3d2d

/home/pjwstk.edu.pl/s16352/python/Theano/theano/__init__.pyc in <module>()
     98 # needed during that phase.
     99 import theano.tests
--> 100 if hasattr(theano.tests, "TheanoNoseTester"):
    101     test = theano.tests.TheanoNoseTester().test
    102 else:

AttributeError: 'module' object has no attribute 'tests'

我在服务器上的 Jupyter 笔记本中运行它。 有什么线索吗?

【问题讨论】:

  • 你安装了哪个版本的 Theano?最新版本还是稳定版本?
  • &gt;&gt;&gt; theano.__version__ '0.9.0rc1.dev-6bfc2ac93782a6fc478ee648fccb0a26a89671d9'

标签: python theano keras


【解决方案1】:

您需要安装旧版本的 Theano:0.8.2。试试pip install Theano==0.8.2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-23
    • 2018-06-23
    • 2017-05-01
    • 1970-01-01
    • 2010-11-18
    相关资源
    最近更新 更多