Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation method of theano and keras in ubuntu system

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Description: the system is a unbuntu14.04LTS,32-bit operating system, previously installed python3.4, now want to install theano and keras. The steps are as follows:

1, install pip

Sudo apt-get install python3-setuptoolssudo easy_install3 pip

2. Install grub +

Sudo apt-get install gathers +

Use the above command to install the galleys, and after the installation is complete, you can use Gateway +-version to check whether the installation is complete. Note that the following error occurs when import theano is not installed:

WARNING (theano.configdefaults): Gmail + 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.

The reason for searching is that theano compiles faster with Gmail +. Most of the solutions found on the Internet are installed based on Anaconda. The solution is:

Conda install mingw libpython

3. Install theano

Sudo pip3 install theano

This command automatically downloads the dependencies required by theano, including numpy,scipy, and so on.

4, install keras

Sudo pip3 install keras

Finally, it is important to note that the default backend for keras is tensorflow, and what we need is theano, so we need to modify the setting. (and tensorflow is installed in pip3, and there is no corresponding version on 32-bit systems! It is complicated to install with source files)

Vim ~ / .keras / keras.json {"image_dim_ordering": "tf", "epsilon": 1e-07, "floatx": "float32", "backend": "theano"}

5. Test theano

Time.time (theano.config.floatX) np_start = time.time () AB = A.dot (B) np_end = time.time () X Magi Y = theano.tensor.matrices ('XY') mf = theano.function ([XMagi 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 (),))

Summary

The above is the installation method of ubuntu system theano and keras introduced by Xiaobian. I hope it will be helpful to you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report