is due to the tensorflow version, if you guessed right you should be using tensorflow2.0 and the source code is tensorflow1. A few versions. So there are errors.
solution :(1) change the import tensorflow as tf to import tensorflow.compat.v1 as tf
(2) use tf.com pat. V1. The flags replace code>
tf. The app. The flags code> p>
either way. I personally recommend the first one.
Download pycharm, select python version, and create a corresponding virtual environment for python in pycharm. If the original tensorflow2.0 version is uninstalled, install tensorflow 1.x version. Remember to check specific Version to install. code> p>