禁用gpu首选

import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

 

config = tf.ConfigProto(allow_soft_placement=True)
config.gpu_options.per_process_gpu_memory_fraction =1 # 占用40%显存
# sess = tf.Session(config=config)

# with tf.Session() as sess:
with tf.Session(config=config) as sess:

with tf.Session() as sess:
with tf.device("/gpu:0"):

/gpu改成cpu
posted @ 2019-07-23 21:22  交流_QQ_2240410488  阅读(460)  评论(0编辑  收藏  举报