Theano - Keras - 没有名为“pool”的模块
Theano - Keras - No Module named `pool`
我已经安装了 bleeding edge theano
,并按以下顺序安装了以下软件包:
gfortran:
sudo apt-get install gfortran
OpenBLAS:
git clone https://github.com/xianyi/OpenBLAS
cd OpenBLAS
make FC=gfortran
sudo make PREFIX=/usr/local install
Anaconda,先下载Anaconda3-2.4.1-Linux-x86_64.sh,然后:
bash Anaconda3-2.4.1-Linux-x86_64.sh
然后,pydot(更新后):
conda update conda
conda update anaconda
conda install pydot
我克隆并安装了 Theano:
git clone git://github.com/Theano/Theano.git
python setup.py develop
我从 windows
移动到 linux
并且很高兴安装了 theano。
我运行一个小脚本,验证它确实能正常工作。
from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy as np
import time
vlen = 10*30*768 # assuming 30 cores and 768 threads per core
iters = 1000
rng = np.random.RandomState(22)
x = shared(np.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print (f.maker.fgraph.toposort() )
t0 = time.time()
for i in range (iters):
r = f()
t1 = time.time()
print("Looping " + str(iters) + " times took " + str(t1-t0) + "seconds")
print("Result is " + str(r))
if np.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
print ("Used the CPU")
else:
print (" Used the GPU")
所以,它是有效的,可能是一个微不足道的例子来证明一点。
之后是keras
git clone https://github.com/fchollet/keras.git
python setup.py install
然后切换到keras的examples目录,输入
python mnist_mlp.py
我收到以下错误:
Traceback (most recent call last):
File "mnist_mlp.py", line 13, in <module>
from keras.models import Sequential
File "/home/user/anaconda3/lib/python3.5/site-packages/Keras-0.3.1-py3.5.egg/keras/models.py", line 15, in <module>
File "/home/user/anaconda3/lib/python3.5/site-packages/Keras-0.3.1-py3.5.egg/keras/backend/__init__.py", line 46, in <module>
File "/home/user/anaconda3/lib/python3.5/site-packages/Keras-0.3.1-py3.5.egg/keras/backend/theano_backend.py", line 4, in <module>
File "/home/user/anaconda3/lib/python3.5/site-packages/Theano-0.8.0.dev0-py3.5.egg/theano/tensor/signal/downsample.py", line 2, in <module>
import pool
ImportError: No module named 'pool'
现在,这到底是怎么回事....我是不是丢了什么包裹?
我认为这不是 keras
的问题,而是 theano
的问题。
我继续尝试了一个卑鄙的把戏,pip install pool
,然后重新运行上面的例子,但我得到了错误:
module 'pool' has no attribute 'max_pool2D'
如果需要,我也可以提供堆栈跟踪。
我在 theano
的过程中遇到了很多困难,急切地想开始......在装置中全部能量耗尽之前,
似乎无法编译文件 theano/tensor/signal/pool.py
有问题并修复 github
我已经安装了 bleeding edge theano
,并按以下顺序安装了以下软件包:
gfortran:
sudo apt-get install gfortran
OpenBLAS:
git clone https://github.com/xianyi/OpenBLAS
cd OpenBLAS
make FC=gfortran
sudo make PREFIX=/usr/local install
Anaconda,先下载Anaconda3-2.4.1-Linux-x86_64.sh,然后:
bash Anaconda3-2.4.1-Linux-x86_64.sh
然后,pydot(更新后):
conda update conda
conda update anaconda
conda install pydot
我克隆并安装了 Theano:
git clone git://github.com/Theano/Theano.git
python setup.py develop
我从 windows
移动到 linux
并且很高兴安装了 theano。
我运行一个小脚本,验证它确实能正常工作。
from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy as np
import time
vlen = 10*30*768 # assuming 30 cores and 768 threads per core
iters = 1000
rng = np.random.RandomState(22)
x = shared(np.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print (f.maker.fgraph.toposort() )
t0 = time.time()
for i in range (iters):
r = f()
t1 = time.time()
print("Looping " + str(iters) + " times took " + str(t1-t0) + "seconds")
print("Result is " + str(r))
if np.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
print ("Used the CPU")
else:
print (" Used the GPU")
所以,它是有效的,可能是一个微不足道的例子来证明一点。
之后是keras
git clone https://github.com/fchollet/keras.git
python setup.py install
然后切换到keras的examples目录,输入
python mnist_mlp.py
我收到以下错误:
Traceback (most recent call last):
File "mnist_mlp.py", line 13, in <module>
from keras.models import Sequential
File "/home/user/anaconda3/lib/python3.5/site-packages/Keras-0.3.1-py3.5.egg/keras/models.py", line 15, in <module>
File "/home/user/anaconda3/lib/python3.5/site-packages/Keras-0.3.1-py3.5.egg/keras/backend/__init__.py", line 46, in <module>
File "/home/user/anaconda3/lib/python3.5/site-packages/Keras-0.3.1-py3.5.egg/keras/backend/theano_backend.py", line 4, in <module>
File "/home/user/anaconda3/lib/python3.5/site-packages/Theano-0.8.0.dev0-py3.5.egg/theano/tensor/signal/downsample.py", line 2, in <module>
import pool
ImportError: No module named 'pool'
现在,这到底是怎么回事....我是不是丢了什么包裹?
我认为这不是 keras
的问题,而是 theano
的问题。
我继续尝试了一个卑鄙的把戏,pip install pool
,然后重新运行上面的例子,但我得到了错误:
module 'pool' has no attribute 'max_pool2D'
如果需要,我也可以提供堆栈跟踪。
我在 theano
的过程中遇到了很多困难,急切地想开始......在装置中全部能量耗尽之前,
似乎无法编译文件 theano/tensor/signal/pool.py
有问题并修复 github