转自:https://blog.csdn.net/mao_hui_fei/article/details/105917063?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-2&spm=1001.2101.3001.4242
限制TensorFlow只在CPU上运行的方法
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
注:上述代码一定要放在import tensorflow或keras等之前,否则不起作用。
标签:限制,blog,environ,CUDA,import,TensorFlow,os,CPU
来源: https://www.cnblogs.com/chuqianyu/p/14337359.html