首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何抑制"WARNING:tensorflow:AutoGraph not transform <bound method Layer.__call__ of ... >>"?

如何抑制"WARNING:tensorflow:AutoGraph not transform <bound method Layer.__call__ of ... >>"?
EN

Stack Overflow用户
提问于 2021-01-21 00:09:50
回答 2查看 1.6K关注 0票数 0

每次运行tf.keras.Sequential().predict_on_batch时都会收到以下消息:

代码语言:javascript
运行
复制
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

EN

回答 2

Stack Overflow用户

发布于 2021-05-06 07:11:04

我在自定义层中遇到过这种情况,其中包含for循环。我一直在用@tf.autograph.experimental.do_not_convert修饰调用方法

例如:

代码语言:javascript
运行
复制
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 
票数 1
EN

Stack Overflow用户

发布于 2021-02-12 11:44:48

使用以下代码设置autograph verbosity级别

代码语言:javascript
运行
复制
import os
import tensorflow as tf
os.environ['AUTOGRAPH_VERBOSITY'] = 1

您可以通过在程序开始时设置日志级别来抑制警告

代码语言:javascript
运行
复制
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' 
import tensorflow as tf
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65813263

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档