Are your the sort of person who likes the good news first or the bad?
The good news is that Tensorflow 2.0, currently in beta, has integrated the Keras API. This means that developers looking to create machine learning and AI models in tensorflow can focus more on architecture and design and less on details of implementation.
The bad news is that Tensorflow 2.0, currently in beta, has integrated the Keras API. This means that none of the Python scripts you wrote for Tensorflow 1.x will work in 2.0. Not a single one. If you have already been using Keras as an external interface you will likely have an easier time migrating to 2.0 than people who have not, but there is still work to do.
It is possible to run a version 1.x script by slightly altering the import:
This method, of course, defeats the purpose of moving to 2.0 and will prevent you from applying best practices in Python code targeting tensorflow 2.0. Details on converting version 1.x code can be found on the Tensorflow website: https://www.tensorflow.org/beta/guide/migration_guide.
Come to think of it, there is a second bit of good news. Virtually all Keras code should work in tensorflow 2.0. The only difference is the import statement. We don’t import keras, we import keras from tensorflow.
import tensorflow as tf
from tensorflow import keras
Modules within keras are imported in the same manner, e.g.
from tensorflow.keras.models import Sequential, Model
Come to think of it, there is also a second bit of bad news. If you are using Keras as a front-end to other deep-learning toolsets such as MXNET of PlaidML, there is no guarantee that future versions of the standalone keras module and the integrated tensorflow.keras module will be synchronized. Indeed, they will probably not be. You will likely have to be careful with your version management.
No one likes to re-write code, but it’s the price to be paid for working in a new and fast-moving area like deep learning. It’s inconceivable that development platforms can get it right the first time; indeed there are still plenty of warts and blemishes remaining to be fixed.
Keras provides the Tensorflow developer the ability to accomplish more with fewer lines of code, but does not extract a price in terms of flexibility or power for its ease of use. As of the middle of 2018, tensorflow and Keras were, respectively, the number one and two most widely adopted deep learning platforms. The integration of Keras into Tensorflow 2.0 would seem to ensure a leadership role for Keras in the deep-learning development community.