每次导入 Tensorflow 时都会发出警告 - “未找到 cudart64_101.dll”。有没有办法只消除这个警告?

2023-12-10

2021-01-26 17:13:35.314383: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2021-01-26 17:13:35.321533: 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.

发生这种情况时,代码的执行往往会暂停一段时间。有针对这个的解决方法吗?


如果您使用 Tensorflow 2.0,请设置TF_CPP_MIN_LOG_LEVEL应该仍然有效

您可以使用 os.environ 禁用所有日志:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 
import tensorflow as tf

Here,

0 = all messages are logged (default behavior)
1 = INFO messages are not printed
2 = INFO and WARNING messages are not printed
3 = INFO, WARNING, and ERROR messages are not printed

(以上是在TensorFlow 0.12和1.0上测试的)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

每次导入 Tensorflow 时都会发出警告 - “未找到 cudart64_101.dll”。有没有办法只消除这个警告? 的相关文章

随机推荐