import tensorflow as tf
print(tf.__version__)
print(‘tf2‘, tf.config.list_physical_devices(‘GPU‘))
print(‘tf2‘, tf.test.is_gpu_available(), tf.__version__) # 不再推荐
import torch
print(‘torch18‘, torch.cuda.is_available(), torch.__version__)
检测tensorflow2和pytorch1.x的GPU环境是否配合正确
原文:https://www.cnblogs.com/hsiangyu-meng/p/15202724.html