我的theano没有signal.conv
模块
import theano.tensor.signal.conv
>>AttributeError: 'module' object has no attribute 'conv'
我的theano版本是'0.7.0'。我尝试升级pip install theano --upgrade
,这表明我已经是最新的。如何获得转换模块?
PS:我什至没有更新到开发版本sudo pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
,仍然没有signal.conv
!
如果我在同一文件夹中theano.tensor.signal.__file__
得到该文件的路径,则/usr/local/lib/python2.7/dist-packages/theano/tensor/signal/__init__.pyc
我拥有文件conv.py和downsample.py,我可以成功调用,theano.tensor.signal.downsample
但不能成功theano.tensor.signal.conv
----在Virtualenv上安装----
我试图在virtualenv上重现该错误:
virtualenv --no-site-packages myenv
cd myenv
source bin/activate
pip install numpy
pip install scipy
pip install theano
python
import theano
theano.tensor.signal.conv
>>AttributeError: 'module' object has no attribute 'conv'
我在Ubuntu 14.04 64位,python 2.7.6上
正如上面的评论中所写,我认为这是由于tensor
未隐式导入signal
甚至没有引起的signal.conv
,因此您必须自己进行导入才能使用它:
In [1]: import theano
In [2]: theano.tensor
Out[2]: <module 'theano.tensor' from '/usr/local/lib/python2.7/site-packages/theano/tensor/__init__.pyc'>
如您所见,导入theano
也为我们提供了theano.tensor
模块,但是例如,由于tensor.__init__.py
不导入signal
,因此以下操作无效:
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'
导入子模块后,它会:
In [5]: import theano.tensor.signal.conv
In [6]: theano.tensor.signal
Out[6]: <module 'theano.tensor.signal' from '/usr/local/lib/python2.7/site-packages/theano/tensor/signal/__init__.pyc'>
In [7]: theano.tensor.signal.conv
Out[7]: <module 'theano.tensor.signal.conv' from '/usr/local/lib/python2.7/site-packages/theano/tensor/signal/conv.pyc'>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句