...

/

Building Graphs and Visualizing Using TensorBoard

Building Graphs and Visualizing Using TensorBoard

Know the difference between eager and graph execution, and learn to build computational graphs and visualize them in TensorBoard.

Eager execution

The eager execution mode is the default option for running the code in TensorFlow2.x. In this mode, the operations execute one after another and return the results immediately. In eager execution, tf.matmul(), for instance, multiplies matrices to return the result in a tf.Tensor object without waiting for any other operation to execute.

The eager execution mode simplifies DL model generation. Eager execution greatly reduces our coding effort to build, analyze, and test models. The native Python environment executes TF ops one after another. Therefore, it’s an excellent option to debug and prototype models if we want to save our coding time.

Graph execution

Graph execution, in contrast to eager execution, is the mode followed by TF1.x versions. Coding in graph mode is time-consuming; graph execution is preferred over eager execution for efficiency. This mode takes full advantage of acceleration options because it builds an optimized graph before the evaluation.

Though eager execution is the default mode for TF2.x versions, we can run ops in TF2 using graph execution. If we operate in the graph mode, an operation such as ...