在Python环境中输入:
import os from tensorflow.python.client import device_lib os.environ["TF_CPP_MIN_LOG_LEVEL"] = "99" if __name__ == "__main__": print(device_lib.list_local_devices())
输出:
[name: "/device:CPU:0" device_type: "CPU" memory_limit: 268435456 locality { } incarnation: 1200794696603410792 , name: "/device:GPU:0" device_type: "GPU" memory_limit: 2454712320 locality { bus_id: 1 links { } } incarnation: 15293349108358879578 physical_device_desc: "device: 0, name: NVIDIA Tegra X2, pci bus id: 0000:00:00.0, compute capability: 6.2"