国产探花免费观看_亚洲丰满少妇自慰呻吟_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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 波密县| 吉水县| 家居| 沿河| 鄂伦春自治旗| 格尔木市| 巫溪县| 肇东市| 基隆市| 永丰县| 桃江县| 曲周县| 南木林县| 松滋市| 修水县| 乌审旗| 博湖县| 九龙坡区| 遵化市| 安溪县| 巨鹿县| 团风县| 涟源市| 双桥区| 尼勒克县| 长宁县| 商洛市| 乡宁县| 榆树市| 灌南县| 竹山县| 涟水县| 正宁县| 中西区| 江北区| 灵武市| 嘉兴市| 大埔县| 库车县| 永寿县| 石首市|