In TensorFlow, what is the primary purpose of enabling eager execution?
Select an answer to reveal the explanation.
Short Explanation
If you're coming from old-school TensorFlow, you remember the pain of building a static graph and running it in a Session. Eager execution fixes that by running operations right away, like Python or NumPy, so you can print values and debug normally.
Full Explanation
TensorFlow supports two execution modes: Graph execution and Eager execution. Eager execution is an imperative, define-by-run interface where operations are evaluated immediately upon invocation from Python. This means TensorFlow operations return concrete values, such as tensors containing actual data, directly to Python, without requiring the construction of a static computational graph that must be executed later within a tf.Session block. This mode simplifies debugging, allows the use of standard Python control flow such as if statements and for loops, and integrates seamlessly with standard Python debugging tools.
The choice describing a static computational graph executed later within a Session describes Graph execution, the default mode in TensorFlow 1.x, where operations define nodes in a directed acyclic graph that must be compiled and executed later. The choice about serializing a model and exporting it to an optimized format for mobile deployment refers to exporting models, such as to TensorFlow Lite or TensorFlow Serving formats, which is independent of the runtime execution mode. The choice about automatically distributing training workloads across multiple physical GPUs refers to distributed execution strategies, such as tf.distribute.Strategy, which are used for scaling training but do not define the immediate execution paradigm of eager execution.
For the exam, keep in mind that eager execution is all about immediate evaluation of operations for dynamic, intuitive development and debugging.