Tensorflow错误和警告



我从非常基本的东西开始学习tensorflow。问题是当我运行这个:

import tensorflow as tf
const_1 = tf.constant(value=[[1.0, 2.0]],
dtype=tf.float32,
shape=(1, 2), 
name='const_1')
print(const_1)

我收到一堵警告墙:

2020-04-09 13:34:33.488108: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-04-09 13:34:33.488461: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-04-09 13:34:36.674495: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-04-09 13:34:36.674803: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
2020-04-09 13:34:36.680089: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: LAPTOP-QKJU2QKP
2020-04-09 13:34:36.680280: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: LAPTOP-QKJU2QKP
2020-04-09 13:34:36.681089: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-04-09 13:34:36.695812: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2012160e230 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-04-09 13:34:36.696238: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version

我做错了什么?我读到我不能安装cuda,因为我有amd gpu。也不知道这是否重要,但tensorflow是通过pycharm安装的。

如另一个答案所述,这似乎很好。如果这些警告让你烦恼,你可以用pip或安装silence_tensorflow

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

在导入Tensorflow之前。

W、I和E都代表(警告、信息和错误(,就像Python中的日志记录模块一样。

当你显示这些信息时,它们告诉你:

  1. 找不到CuDNN.dll(用于在GPU上运行(
  2. 附加信息+一个无法获取GPU使用所需库的错误
  3. 最后服从CPU

您在流程中没有做错任何事。

最新更新