First, the historical entanglement between Keras and TensorFlow
Keras was originally created by Google AI developer/researcher Francois Chollet, and the first version of Keras was committed and released to his GitHub on March 27, 2015.
TensorFlow has become the default backend of Keras since the Keras v1.1.0 release (before v1.1.0, the default backend of Keras was Theano).
tf.keras was introduced into TensorFlow in TensorFlow v1.10.0.
Google released TensorFlow 2.0 in June 2019 and announced that Keras is now the official high-level API of TensorFlow. Following the release of Keras 2.3.0, Francois stated:
This is Keras v2.3.0 is the first version synchronized with tf.keras;
This will also be the last version that supports backends other than TensorFlow (ie Theano, CNTK, etc.).
Most importantly, all deep learning practitioners should convert their code into TensorFlow 2.0 and tf.keras packages. The original keras package will still receive bugs and fixes.
2. Introduction to keras and tf.keras
1. Introduction to keras
Python-based advanced neural network API
Francois Chollet wrote Keras in 2014-2015
To run with Tensorflow, CNTK or Theano as the backend, keras must have a backend to run
The backend can be switched, now more use tensorflow
Extremely convenient for quick experiments, helping users to verify their ideas in the least amount of time
2. Introduction to tf.keras
Tensorflow's implementation of the keras API specification
Compared with keras with tensorflow as the backend, Tensorflow-keras and Tensorflow are more closely integrated
Realized in the tf.keras space
Third, the difference between keras and tf.keras
Tf.keras fully supports eager mode
It just has no effect when using keras.Sequential and keras.Model
It will have an impact when customizing the internal calculation logic of the Model
Tf low-level API can use keras model.fit and other abstractions
Suitable for researchers
Tf.keras supports model training based on tf.data
Tf.keras supports TPU training
Tf.keras supports the distributed strategy of tf.distribution
Fourth, the connection between keras and tf.keras
Based on the same set of API
The keras program can be easily converted to the tf.keras program by changing the import method
The opposite may not be true, because tf.keras has other features
The same JSON and HDF5 model serialization format and semantics