Search code examples
kerastheanotf.kerascntk

Are there syntax differences between using Keras with a Tensorflow 2, Theano, or CNTK backend?


It looks like tf.keras is suggested if you're using a Tensorflow 2 backend, but what about using Theano or CNTK as a backend? I have never used Keras or any DL library.


Solution

  • Keras has officially decided to drop support of CNTK and Theano moving forward. Therefore, if you are using keras with tensorflow as the backend, you should use tf.keras.

    For older versions for keras, you can use all three backend with no syntax change in your keras code.

    Keras 2.2.5 was the last release of Keras implementing the 2.2.* API. It was the last release to only support TensorFlow 1 (as well as Theano and CNTK).

    The current release is Keras 2.3.0, which makes significant API changes and add support for TensorFlow 2.0. The 2.3.0 release will be the last major release of multi-backend Keras. Multi-backend Keras is superseded by tf.keras.

    You can find the above information here.