从keras导入后端,因为K引发错误AttributeError:'module'对象没有属性'set_session'

时间:2018-09-11 19:25:08

标签: keras

我正在使用keras 2.2.2

这是示例代码。我添加了水印详细信息

%watermark -n -v -m -p keras
from keras import backend as K
K.set_session

以下是输出:

Tue Sep 11 2018 
CPython 2.7.13
IPython 5.3.0
keras 2.2.2
compiler   : GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)
system     : Darwin
release    : 15.6.0
machine    : x86_64
processor  : i386
CPU cores  : 8
interpreter: 64bit
Error:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-25-5903f2fb2668> in <module>()
      1 get_ipython().magic(u'watermark -n -v -m -p keras')
      2 from keras import backend as K
----> 3 K.set_session

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

clear_session()出现相同的错误

keras.backend.clear_session()

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

0 个答案:

没有答案