title: Performance of tensorflow built-in training loops vs customized training loops
body: <p>I have justed coded a subclassing model in tensorflow 2.0 using tf.keras.Model and I use a cumstomized training loop. Training takes for ever! I came across this tensorflow example <a href="https://www.tensorflow.org/guide/keras/custom_layers_and_models" rel="nofollow noreferrer">VAE</a>, which is very similar to my model and how I customized my training loop. I have run the tensorflow example in the link using both the customized and built-in training function and the former takes about 90 secs for 10 epochs, while the latter only takes 20 secs.</p>
  
  <p>Why is the customized loop slower and how can it be improved to train as fast as the built-in fit function? Here is a link to run just the VAE in the link above <a href="https://colab.research.google.com/drive/1ge0S8LudiLHVcrsGMwcmp0pBc-hetC5S" rel="nofollow noreferrer">run_vae</a></p>
  
  <pre><code>problem for my own model in tensorflow example 
  </code></pre>