教你如何一招查看 Tensorflow 是GPU版本 or CPU版本

2023-02-20 11:46:41 浏览数 (1)

查看 Tensorflow 是GPU还是CPU版本

Python环境中输入:

代码语言:javascript复制
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())
代码语言:javascript复制
[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"

即可查看!

未经允许不得转载:肥猫博客 » 教你如何一招查看 Tensorflow 是GPU版本 or CPU版本

0 人点赞