判断tensorflow pytorch是否是GPU import tensorflow as tf import torch print(tf.test.is_gpu_available()) print(torch.cuda.is_available()) 要是返回True那就是GPU