吴天德少侠 2021-04-09 17:09 采纳率: 50%
浏览 195

原代码是基于cpu下写的,现在有了GPU,需要怎么修改才能用GPU呢?

如题,谢谢各位大佬。我在代码一开始添加了这些代码:

gpus = tf.config.experimental.list_physical_devices(device_type='GPU')
tf.config.experimental.set_visible_devices(devices=gpus[0:3], device_type='GPU')
for gpu in gpus:
    tf.config.experimental.set_memory_growth(gpu, True)

但是查看gpu使用情况发现gpu使用率为0,可是显存在用?

求看到的大佬指点,谢谢!

  • 写回答

0条回答 默认 最新

    报告相同问题?