Eager Execution

Eager execution provides an imperative interface to TensorFlow (similar to NumPy). When you enable eager execution, TensorFlow operations execute immediately; you do not execute a pre-constructed graph with Session.run().

For example, consider a simple computation in TensorFlow:

x = tf.placeholder(tf.float32, shape=[1, 1])
m = tf.matmul(x, x)

with tf.Session() as sess:
  print(sess.run(m, feed_dict={x: [[2.]]}))

# Will print [[4.]]

Eager execution makes this much simpler:

x = [[2.]]
m = tf.matmul(x, x)

print(m)

Caveats

This feature is in early stages and work remains to be done in terms of smooth support for distributed and multi-GPU training and performance.

Installation

For eager execution, we recommend using TensorFlow version 1.8 or newer. Installation instructions at https://www.tensorflow.org/install/

Documentation

For an introduction to eager execution in TensorFlow, see: