检测 TensorFlow 是否调用 GPU
import tensorflow as tf
if tf.config.list_physical_devices("GPU"):
print("TensorFlow is using the GPU")
else:
print("TensorFlow is using the CPU")
print(tf.config.list_physical_devices("GPU")) # 打印可用的 GPU 设备列表
检测 TensorFlow 是否调用 GPU
http://localhost:8090/archives/check-tensorflow-gpu