安装了Theano和keras之后,准备走段代码出错了,大概意思是:
“Theano is missing signal”,就是说signal模块找不到,我跑到
源代码目录下看是有这个的:
明明有的啊,流泪!!!
只好googl了一下,发现也有人跟我差不多的问题:
Best Answer:
As you can see importing theano also gets us the theano.tensor module, but as tensor.init.py doesn’t import signal for example, the following does not work:
In [3]: theano.tensor.signal
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-53b46c46cb25> in <module>()
----> 1 theano.tensor.signal
AttributeError: 'module' object has no attribute 'signal'
In [4]: theano.tensor.signal.conv
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-b2a3482abaed> in <module>()
----> 1 theano.tensor.signal.conv
AttributeError: 'module' object has no attribute 'signal'
就是说,上层的_init_没有显示的进行import
于是修改文件,tensor/init.py,
最后一行加入:
from theano.tensor import signal
此时再次导入,成功:
我以为一切正常了,谁知道生活又开了个玩笑,是的又出错啦:
AttributeError: 'module' object has no attribute 'conv'
AttributeError: 'module' object has no attribute 'downsample'
说的是signal没有conv和downsample,流泪了!!!
跟上面方法一样,这次修改了init.py,显示导入:
from theano.tensor.signal import conv
from theano.tensor.signal import downsample
这次倒好,直接import theano都出错了!!!!
最后发现可以在代码里面显示的导入上面两行,代码运行正常。
PS:
好像这个错,过几天无故就没了,我的就是过了几天不显示导入都可以直接运行,也不知道是什么原因
有知道的大侠们,烦请告知我一下哈!