错误提示:
InvalidArgumentError (see above for traceback): Cannot assign a device for operation G_paper_1/Run/G_paper_1/latents_in: node G_paper_1/Run/G_paper_1/latents_in (defined at /home/abc/Downloads/iGAN-HD-master/iGAN_HD-v2-1024/tfutil.py:508) was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:XLA_CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled.
原因是tf里的一个bug,解决方法是设置配置里面的allow_soft_placement=True,当运行在出现不允许在GPU运行的时候,可以切换到CPU运行。
解决方法:
tf.ConfigProto()内添加allow_soft_placement=True
run_config = tf.ConfigProto(allow_soft_placement=True)