WARNING:tensorflow:5 out of the last 8 calls to <function NerModel.call at 0x1300295e0> 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 reduce_retracing=True option 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.
在在预测过程，输入如果是可变长度，那么会提示这个，看提示信息应该知道，Tracing is expensive，tf.function函数的入参尽量符合一下规则：
3、使用@tf.function(experimental_relax_shapes = True)选项，该选项可放宽参数形状，从而避免不必要的跟踪 那这边推荐在预测过程中，注释掉tf.function 在训练过程中开启