tensorflowkerasdifferencetf.keras

What is the difference between keras and tf.keras?


I'm learning TensorFlow and Keras. I'd like to try https://www.amazon.com/Deep-Learning-Python-Francois-Chollet/dp/1617294438/, and it seems to be written in Keras.

Would it be fairly straightforward to convert code to tf.keras?

I'm not more interested in the portability of the code, rather than the true difference between the two.


Solution

  • At this point tensorflow has pretty much entirely adopted the keras API and for a good reason - it's simple, easy to use and easy to learn, whereas "pure" tensorflow comes with a lot of boilerplate code. And yes, you can use tf.keras without any issues, though you might have to re-work your imports in the code. For instance

    from keras.layers.pooling import MaxPooling2D
    

    Would turn into:

    from tensorflow.keras.layers import MaxPooling2D