1. 用cmd进入安装tensorflow2.0-gpu的环境下的python,输入代码检测,如下图所示。
Microsoft Windows [版本 10.0.18362.836]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\赵立铭>activate tensorflow2_gpu

(tensorflow2_gpu) C:\Users\赵立铭>python
Python 3.6.10 |Anaconda, Inc.| (default, Mar 23 2020, 17:58:33) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-05-21 09:46:58.142643: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
>>> print(tf.__version__)
2.0.0
>>> print(tf.test.is_gpu_available())
2020-05-21 09:47:58.730470: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-05-21 09:47:58.752614: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-05-21 09:47:59.744516: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 0000:01:00.0
2020-05-21 09:47:59.751721: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-05-21 09:47:59.759183: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-05-21 09:48:03.133562: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-05-21 09:48:03.140510: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0
2020-05-21 09:48:03.143501: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N
2020-05-21 09:48:03.151461: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:0 with 3001 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)
True
>>>

若无报错,且检验gpu返回值为ture即证明tensorflow2_gpu安装成功。

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐