我得到一个警告,我找不到解决方案。显然这:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # or any {'0', '1', '2'}
import tensorflow as tf
os.environ['AUTOGRAPH_VERBOSITY'] = '1'
不足以阻止这个烦人的消息:
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
在每个纪元之后弹出。
是的,我已经用@tf.autograph.experimental.do_not_convert
装饰了我的每个函数,消息仍然弹出。我目前正在使用Tensorflow 2.2.0
如果你知道为什么会这样,那就太好了。我不知道什么名字。
试试这个:
tf.autograph.set_verbosity(0)
如果不工作,也许logging
模块可以在这里提供帮助:
import logging
logging.getLogger("tensorflow").setLevel(logging.ERROR) # this goes *before* tf import
import tensorflow as tf
感谢@Shahrokh Bah的评论。