http://deeplearning.net/software/theano/install_windows.html
下載下傳:
git clone https://github.com/Theano/Theano.git
配置(cd到Theano根目錄):
python setup.py develop
測試:
import theano
提示:WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
解決g++問題:
$ conda install mingw libpython
在theano的根目錄下執行哈。。
測試:
import numpy as np
import time
import theano
A = np.random.rand(1000,10000).astype(theano.config.floatX)
B = np.random.rand(10000,1000).astype(theano.config.floatX)
np_start = time.time()
AB = A.dot(B)
np_end = time.time()
X,Y = theano.tensor.matrices('XY')
mf = theano.function([X,Y],X.dot(Y))
t_start = time.time()
tAB = mf(A,B)
t_end = time.time()
print "NP time: %f[s], theano time: %f[s] (times should be close when run on CPU!)" %(
np_end-np_start, t_end-t_start)
print "Result difference: %f" % (np.abs(AB-tAB).max(), )
結果:
NP time: 0.357000[s], theano time: 0.272000[s] (times should be close when run on CPU!)
Result difference: 0.000000
注意啊,如果你的第二個時間比第一個時間長,說明上面的g++問題沒有解決,這裡要注意(conda install指令要在theano的根目錄下執行哈。。)。
完美!
http://deeplearning.net/software/theano/install_ubuntu.html#install-ubuntu
For NVIDIA Jetson TX1 embedded platform:
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libblas-dev git
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git --user # Need Theano 0.8(not yet released) or more recent
For Ubuntu 11.10 through 14.04:
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano
For Ubuntu 11.04:
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ git libatlas3gf-base libatlas-dev
sudo pip install Theano
linux下一樣,我選擇手動下載下傳theano,然後:
git clone git://github.com/Theano/Theano.git
cd Theano
python setup.py develop --user