运行以下代码
from tensorflow.python.client import device_libprint(device_lib.list_local_devices())
若出现以下CPU、GPU信息,说明环境配置没问题,享受GPU带来的加速吧
[name: "/device:CPU:0"device_type: "CPU"memory_limit: 268435456locality {}incarnation: 13915861037942189575, name: "/device:GPU:0"device_type: "GPU"memory_limit: 1476712857locality {bus_id: 1links {}}incarnation: 955197386324155545physical_device_desc: "device: 0, name: GeForce 940M, pci bus id: 0000:01:00.0, compute capability: 5.0"]