Book Image

Deep Learning with TensorFlow 2 and Keras - Second Edition

By : Antonio Gulli, Amita Kapoor, Sujit Pal
Book Image

Deep Learning with TensorFlow 2 and Keras - Second Edition

By: Antonio Gulli, Amita Kapoor, Sujit Pal

Overview of this book

Deep Learning with TensorFlow 2 and Keras, Second Edition teaches neural networks and deep learning techniques alongside TensorFlow (TF) and Keras. You’ll learn how to write deep learning applications in the most powerful, popular, and scalable machine learning stack available. TensorFlow is the machine learning library of choice for professional applications, while Keras offers a simple and powerful Python API for accessing TensorFlow. TensorFlow 2 provides full Keras integration, making advanced machine learning easier and more convenient than ever before. This book also introduces neural networks with TensorFlow, runs through the main applications (regression, ConvNets (CNNs), GANs, RNNs, NLP), covers two working example apps, and then dives into TF in production, TF mobile, and using TensorFlow with AutoML.
Table of Contents (19 chapters)
17
Other Books You May Enjoy
18
Index

Understanding TensorFlow 2.x

As discussed, TensorFlow 2.x recommends using a high-level API such as tf.keras, but leaves low-level APIs typical of TensorFlow 1.x for when there is a need to have more control on internal details. tf.keras and TensorFlow 2.x come with some great benefits. Let's review them.

Eager execution

TensorFlow 1.x defines static computational graphs. This type of declarative programming might be confusing for many people. However, Python is typically more dynamic. So, following the Python spirit, PyTorch, another popular deep learning package, defines things in a more imperative and dynamic way: you still have a graph, but you can define, change, and execute nodes on-the-fly, with no special session interfaces or placeholders. This is what is called eager execution, meaning that the model definitions are dynamic, and the execution is immediate. Graphs and sessions should be considered as implementation details.

Both PyTorch and TensorFlow 2 styles...