Open rmurphy2718 opened 2 years ago
Hi @rmurphy2718 ,
Thanks for your question.
In the 3rd edition (coming out in October), I no longer use keras.backend. You can see the code in ageron/handson-ml3.
The reason I used it in the second edition is that I wanted the code to be as portable as possible to other Keras implementations, such as those based on Theano or MXNet rather than TensorFlow. Sadly, these other implementations no longer exist, and Keras is currently TensorFlow-only. However, there are discussions about creating a JAX-based implementation of Keras, but AFAIK it's not started yet.
As long as TensorFlow is the only backend for Keras, there's no much point in using keras.backend instead of calling the TensorFlow functions directly.
Hope this helps.
In the book and notebooks, functions from
keras.backend
are sometimes used instead oftf
functions. For example, we might seeK = keras.backend
followed byK.mean
instead oftf.reduce_mean
. I am asking generally, but an example can be seen in19_training_and_deploying_at_scale.ipynb
tf
reduce functions like this?