您的位置:首页 > 其它

How to install and run keras on GPU

2016-09-03 09:00 423 查看

install

http://keras-cn.readthedocs.io/en/latest/getting_started/install/

gpu run

first way

import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32"
import theano
import keras


second way

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


test

cpu方式运行:python mnist_cnn.py



gpu方式运行:THEANO_FLAGS=device=gpu,floatX=float32 python mnist_cnn.py

默认模式,即mode=FAST_COMPILE,gpu快的太多了!



reference

http://buptldy.github.io/2016/04/09/2016-04-09-Deepin%20CUDA%E5%AE%89%E8%A3%85%E5%8F%8AKeras%E4%BD%BF%E7%94%A8GPU%E6%A8%A1%E5%BC%8F%E8%BF%90%E8%A1%8C/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  gpu keras