Book Image

What's New in TensorFlow 2.0

By : Ajay Baranwal, Alizishaan Khatri, Tanish Baranwal
Book Image

What's New in TensorFlow 2.0

By: Ajay Baranwal, Alizishaan Khatri, Tanish Baranwal

Overview of this book

TensorFlow is an end-to-end machine learning platform for experts as well as beginners, and its new version, TensorFlow 2.0 (TF 2.0), improves its simplicity and ease of use. This book will help you understand and utilize the latest TensorFlow features. What's New in TensorFlow 2.0 starts by focusing on advanced concepts such as the new TensorFlow Keras APIs, eager execution, and efficient distribution strategies that help you to run your machine learning models on multiple GPUs and TPUs. The book then takes you through the process of building data ingestion and training pipelines, and it provides recommendations and best practices for feeding data to models created using the new tf.keras API. You'll explore the process of building an inference pipeline using TF Serving and other multi-platform deployments before moving on to explore the newly released AIY, which is essentially do-it-yourself AI. This book delves into the core APIs to help you build unified convolutional and recurrent layers and use TensorBoard to visualize deep learning models using what-if analysis. By the end of the book, you'll have learned about compatibility between TF 2.0 and TF 1.x and be able to migrate to TF 2.0 smoothly.
Table of Contents (13 chapters)
Title Page

Summary

TF 2.0 contains many major changes, such as API cleanup, eager execution, and an object-oriented philosophy. The API cleanup includes deprecating redundant modules that have equivalent standard Python libraries, as well as removing and reorganizing the tf.contrib module into the main API and into the TensorFlow Addons package. Eager execution and object-oriented APIs allow debugging to be much more efficient and straightforward, and also lead to variables being treated as normal Python variables. This means that variable collections and other APIs dedicated to dealing with global variables are no longer needed, and thus are removed in TF 2.0.

TF 2.0 also shifts the default high-level API from estimators in TF 1.x to tf.keras in TF 2.0 for both simplicity and scalability. The tf.keras API has three different programming types, each providing different levels of abstraction and customizability. Low-level TF 2.0 code can be written using tf.GradientTape to handle gradients of operations, and tf.function for graph-based execution.

This chapter also covered the different ways to install TF 2.0, including installation through pip and Docker, as well as the installation of the GPU version. There are many modules that are compatible with and have been released alongside TF 2.0, which further enhance and augment the possibilities of the base API. These include TensorFlow Datasets, TensorFlow Addons, TensorFlow Text, and TensorFlow Probability.

This chapter also included Ragged Tensors, which are useful for storing data with variable length and shape and hierarchical inputs. This means that Ragged Tensors are useful for storing language and sequence data.

In the next chapter, we will learn about Keras' default integration and eager execution.