【问题标题】:How to suppress all autograph warnings from Tensorflow?如何抑制来自 Tensorflow 的所有签名警告?
【发布时间】:2021-03-12 00:28:49
【问题描述】:

我收到一条警告,但我找不到解决方案。 显然是这样的:

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

在每个 epoch 之后弹出。

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

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

【问题讨论】:

    标签: python python-3.x tensorflow keras


    【解决方案1】:

    试试这个:

    tf.autograph.set_verbosity(0)
    

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

    import logging
    logging.getLogger("tensorflow").setLevel(logging.ERROR)
    

    【讨论】:

      猜你喜欢
      • 2021-12-27
      • 1970-01-01
      • 1970-01-01
      • 2012-06-20
      • 1970-01-01
      • 2011-01-04
      • 1970-01-01
      • 1970-01-01
      • 2021-12-23
      相关资源
      最近更新 更多