TromboneDavies / PolarOps

0 stars 0 forks source link

Figure out hellacious warning #57

Closed divilian closed 2 years ago

divilian commented 3 years ago

WARNING:tensorflow:11 out of the last 11 calls to <function Model.make_predict_function..predict_function at 0x7f3d6c243940> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.

divilian commented 2 years ago

This is apparently a red herring, and the annoying warning can be supressed via:

import tensorflow.compat.v1.logging tensorflow.compat.v1.logging.set_verbosity(tensorflow.compat.v1.logging.ERROR)