当前位置:网站首页>Tensorflow 1.14 specify GPU running settings

Tensorflow 1.14 specify GPU running settings

2022-07-07 01:00:00 The mountain of ignorance, the valley of despair, the slope of

Be careful :allow_soft_placement=True indicate : Computing devices are optional , If you don't have this parameter , Will report a mistake .
Because not all operations can be placed in GPU On , If forced will not be able to put in GPU The operation on is assigned to GPU On , Will be an error .

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"    #  Here is gpu The serial number of , Designated to use gpu object 
gpu_options = tf.GPUOptions()
gpu_options.allow_growth = True
config_photo = tf.ConfigProto(allow_soft_placement=True, gpu_options=gpu_options, log_device_placement=True)
self.sess = tf.Session(config=config_photo)
原网站

版权声明
本文为[The mountain of ignorance, the valley of despair, the slope of ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207061710264505.html