我要删除的代码运行警告

时间:2019-07-11 02:36:22

标签: python tensorflow keras warnings

我使用的代码向我显示了很多无用的警告,例如change np.arrow for tf.arrowthis version will be fixed in next versions ...该警告并没有帮助我,因为我现在真的不需要它了,并且想要知道如何抑制或删除它。

我尝试了warning_ignore ...和另一个带有warningfilter的代码,但是这些都不起作用,并且警告仍然可见。

Using TensorFlow backend. WARNING: Logging before flag parsing goes to stderr. W0709 10:34:02.424996 12116 deprecation_wrapper.py:119] From C:\Users\ROBERTO VILCHEZ\AppData\Roaming\Python\Python36\site- packages\keras\backend\tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W0709 10:34:02.484447 12116 deprecation_wrapper.py:119] From C:\Users\ROBERTO VILCHEZ\AppData\Roaming\Python\Python36\site- packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

W0709 10:34:02.499438 12116 deprecation_wrapper.py:119] From C:\Users\ROBERTO VILCHEZ\AppData\Roaming\Python\Python36\site- packages\keras\backend\tensorflow_backend.py:3976: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

W0709 10:34:02.514367 12116 deprecation_wrapper.py:119] From C:\Users\ROBERTO VILCHEZ\AppData\Roaming\Python\Python36\site- packages\keras\backend\tensorflow_backend.py:245: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

多数民众赞成在同一形式的许多警告中,我只想删除它。我尝试将tf ....替换为tf ...,但是我的代码无法正常工作,因此我只想删除这些警告。

1 个答案:

答案 0 :(得分:0)

尝试设置日志级别

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