title: Running the Tensorflow 2.0 code gives 'ValueError: tf.function-decorated function tried to create variables on non-first call'. What am I doing wrong?
body: <p><a href="https://colab.research.google.com/drive/1lipWy-B6BrtZlARM_amdnc7zgKiFaSRR" rel="noreferrer">error_giving_notebook</a></p>
  
  <p><a href="https://colab.research.google.com/drive/1ksJgAXniJZIm8S4EmPDIE3hA7DuwWs0a" rel="noreferrer">non_problematic_notebook</a></p>
  
  <p>As it can be seen that I have used tf.function decorator in the 'error_giving_notebook' and it throws a ValueError while the same notebook without any changes except for removing the tf.function decorator runs smoothly in 'non_problematic_notebook'. What can be the reason? </p>