在配置TensorFlow使用GPU之前,需要确保您的系统符合以下要求:
以下是配置TensorFlow使用GPU的步骤:
import tensorflow as tf
if tf.test.is_gpu_available():
print('GPU is available')
else:
print('GPU is not available')
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
with tf.Session(config=config) as sess:
# Your TensorFlow code here
通过以上步骤,您就可以配置TensorFlow使用GPU来加速计算。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: tensorflow模型上线部署的方法是什么