Hello!
Can someone please advise me how can I get rid of this warning received while training a custom model?
If I train several times a custom model with the same data, I receive the warning below once in a while.
It is strange also that the message says that only in 6 out of 8 tries it encountered a problem, although I use exactly the same data every time.
I use only tensorflow objects so I do not know what generates this message.
“WARNING:tensorflow:6 out of the last 8 calls to <function Model.make_predict_function..predict_function at 0x7f90184d5310> 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 Better performance with tf.function | TensorFlow Core and tf.function | TensorFlow v2.16.1 for more details.”
Thank you,