如何抑制来自 Tensorflow 的所有签名警告?

exp*_*101 1 python python-3.x keras tensorflow

我收到一个警告,我找不到解决办法。显然是这样的:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'  # or any {'0', '1', '2'}
import tensorflow as tf
os.environ['AUTOGRAPH_VERBOSITY'] = '1'
Run Code Online (Sandbox Code Playgroud)

不足以阻止这条烦人的消息:

WARNING:tensorflow:AutoGraph could not transform <function Model.make_train_function.<locals>.train_function at 0x00000281A55264C8> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: Bad argument number for Name: 4, expecting 3
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
Run Code Online (Sandbox Code Playgroud)

每个纪元后都会弹出。

是的,我装饰了我拥有的每一个功能 @tf.autograph.experimental.do_not_convert,但消息仍然弹出。我目前正在使用 Tensorflow 2.2.0

如果您知道发生这种情况的原因,那就太好了。我不知道“名称”是什么,因为我的任何文件中都没有任何名称。

vic*_*oom 5

尝试这个:

tf.autograph.set_verbosity(0)
Run Code Online (Sandbox Code Playgroud)

如果这不起作用,也许该logging模块可以在这里提供帮助:

import logging
logging.getLogger("tensorflow").setLevel(logging.ERROR)
Run Code Online (Sandbox Code Playgroud)