2016-01-20 57 views
5

我已經安裝了bleeding edge theano,並按照以下順序以下軟件包:Theano - Keras - 沒有名爲'模塊pool`

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 

蟒蛇,首先下載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的實例目錄,只需鍵入

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去掙扎了很多,急切地想之前在安裝整個能源水渠上手...,

+0

順便說一句,我使用CPU, – Adorn

+2

它似乎無法編譯文件theano /張量/信號/ pool.py有一個問題和修復[github](https://github.com/Theano/Theano/問題/ 3894) –

+0

@FabioFumarola鍵入這個答案,我很樂意接受。它解決了這個問題 – Adorn

回答

2

似乎無法編譯文件theano/tensor/signal/pool.py有一個問題,並修復github