gll89的个人博客分享 http://blog.sciencenet.cn/u/gll89

博文

allocate GPU ID to the code python

已有 2211 次阅读 2017-5-12 09:40 |个人分类:Python|系统分类:科研笔记

add the following codes to allocate a GPU to your codes:


>>>import tensorflow as tf
>>>from keras.backend.tensorflow_backend import set_session

>>>np.set_printoptions(suppress=True)
>>>os.environ["CUDA_VISIBLE_DEVICES"]="0"
>>>config = tf.ConfigProto()
>>>config.gpu_options.per_process_gpu_memory_fraction = 0.95
>>>set_session(tf.Session(config=config))



https://blog.sciencenet.cn/blog-1969089-1054493.html

上一篇:batch BET
下一篇:video recognition using attention visual
收藏 IP: 128.227.206.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-7-26 22:25

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部