每次运行tf.keras.Sequential().predict_on_batch时都会收到以下消息:
WARNING: AutoGraph could not transform <bound method Layer.__call__ of <tensorflow.python.keras.engine.sequential.Sequential object at 0x000001F927581348>> 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:
它完全填满了我的控制台,我找不到一种方法来抑制它。
Python版本: 3.7.7 Tensorflow版本: 2.1.0
发布于 2021-05-06 07:11:04
我在自定义层中遇到过这种情况,其中包含for循环。我一直在用@tf.autograph.experimental.do_not_convert
修饰调用方法
例如:
class DoNothing(tf.keras.layers.Layer):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def get_config(self):
config = {}
base_config = super().get_config()
return {**base_config, **config}
@tf.autograph.experimental.do_not_convert
def call(self, args, **kwargs):
return args # Yes, this layer really doesn't do anything
发布于 2021-02-12 11:44:48
使用以下代码设置autograph verbosity级别
import os
import tensorflow as tf
os.environ['AUTOGRAPH_VERBOSITY'] = 1
或
您可以通过在程序开始时设置日志级别来抑制警告
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
https://stackoverflow.com/questions/65813263
复制相似问题