Tensorflow 2.0 model using tf.function very slow and is recompiling every time the train count changes. Eager runs about 4x faster
问题 I have models built from uncompiled keras code and am trying to run them through a custom training loop. The TF 2.0 eager (by default) code runs about 30s on a CPU (laptop). When I create a keras model with wrapped tf.function call methods, it is running much, much slower and appears to take a very long time to start, particularly the "first" time. For example, in the tf.function code the initial train on 10 samples takes 40s, and the follow up one on 10 samples takes 2s. On 20 samples, the