# 查看gpu数
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
#设置训练所需的GPU的memory随需求而增长
tf.config.experimental.set_memory_growth(gpus[0],True)
tensorflow2 GPU数的查查和设置
最新推荐文章于 2023-03-30 15:41:37 发布
# 查看gpu数
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
#设置训练所需的GPU的memory随需求而增长
tf.config.experimental.set_memory_growth(gpus[0],True)