复制代码
1
2
3
4
5
6
7
8
9
10import tensorflow as tf gpus = tf.config.list_physical_devices("GPU") print(gpus) if gpus: gpu0 = gpus[0] #如果有多个GPU,仅使用第0个GPU tf.config.experimental.set_memory_growth(gpu0, True) #设置GPU显存用量按需使用 tf.config.set_visible_devices([gpu0],"GPU")
最后
以上就是要减肥服饰最近收集整理的关于tensorflow2中如何设置GPU的使用的全部内容,更多相关tensorflow2中如何设置GPU内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复