Chapter 2. Eager Execution

This chapter covers eager execution mode in TensorFlow 2.x. Eager execution is considered to be one of the most drastic changes in TensorFlow 2.x—drawing a lot of attention from the PyTorch community as well. Eager execution was introduced in TensorFlow 1.x but was not enabled by default for performance and compatibility reasons. It’s now at a level where it is enabled by default. Let’s understand why this was such a game changer.

Python: The De Facto Standard in Data Science

TensorFlow natively supports Python, C, C++, Go, Java, JavaScript, and Swift programming languages. Third-party support for C#, Haskell, Julia, R, Scala, Rust, OCaml, and Crystal exists. Since the execution engine of TensorFlow itself is written in C++, programming language support is called language binding. From all available language bindings for TensorFlow, Python is definitely the most widely used in the data science community. Python focuses on readability and understandability of code. In Python, there exists only that much syntax sugar necessary to get things done. The programmer’s mind doesn’t get lost in the features and functions of the programming language but can concentrate on coding. Therefore, Python is considered to be a highly productive programming language.

Why Eager Execution Is So Important

Eager execution is undoubtedly one of the most prominent new features—introduced in TensorFlow 1.7—activated by default in TensorFlow 2.x. Eager execution allows the ...

Get What's New In TensorFlow 2.x? now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.