Reputation: 119
I get this message every time I run 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:
It completely fills my console, and I can't find a way to suppress this.
Python version: 3.7.7 Tensorflow version: 2.1.0
Upvotes: 1
Views: 4902
Reputation: 99
I've come across this in custom layers with for loops in them. I've been decorating the call method with @tf.autograph.experimental.do_not_convert
For example:
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
Upvotes: 2
Reputation:
Set the autograph verbosity level using the below code
import os
import tensorflow as tf
os.environ['AUTOGRAPH_VERBOSITY'] = 1
OR
You can just suppress warning by setting log level at the start of the program
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
Upvotes: 1