国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Keras 切換GPU

2019-11-08 02:53:01
字體:
來源:轉載
供稿:網友

https://keras.io/getting-started/faq/  查看Keras 官方文檔

If you are running on the TensorFlow backend, your code will automatically run on GPU if any available GPU is detected.If you are running on the Theano backend, you can use one of the following methods:

Method 1: use Theano flags.

THEANO_FLAGS=device=gpu,floatX=float32 python my_keras_script.py

The name 'gpu' might have to be changed depending on your device's identifier (e.g.gpu0, gpu1, etc).

Method 2: set up your .theanorc: Instructions

Method 3: manually set theano.config.device, theano.config.floatX at the beginning of your code:

import theanotheano.config.device = 'gpu'theano.config.floatX = 'float32'

因為在服務器上跑CNN,在$HOME 下我使用的vim ~.theanorc, 添加

[global]floatX = float32device = gpu0[lib]cnmem = 1之后keras就會使用GPU而不是CPU跑網絡。

運行成功,會打印

Using Theano backend.Using gpu device 0: GeForce GTX 1080


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 石林| 贵德县| 白银市| 从江县| 集安市| 贵南县| 长顺县| 鄂托克旗| 临夏市| 绍兴市| 马山县| 双江| 阳信县| 兖州市| 吴桥县| 色达县| 西乌| 靖州| 田阳县| 澄江县| 临邑县| 长武县| 连城县| 神木县| 新平| 探索| 温泉县| 滦南县| 泗洪县| 华阴市| 蒙阴县| 大同县| 兰州市| 博乐市| 卓资县| 浦城县| 兴海县| 西乌| 宣威市| 蕉岭县| 呼和浩特市|