ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more


Return the handle of data.

This is EXPERIMENTAL and subject to change.

Keep data "in-place" in the runtime and create a handle that can be used to retrieve data in a subsequent run().

Combined with get_session_tensor, we can keep a tensor produced in one run call in place, and use it as the input in a future run call.

data A tensor to be stored in the session.
name Optional name prefix for the return tensor.

A scalar string tensor representing a unique handle for data.

TypeError if data is not a Tensor.


c = tf.multiply(a, b)
h = tf.compat.v1.get_session_handle(c)
h =

p, a = tf.compat.v1.get_session_tensor(h.handle, tf.float32)
b = tf.multiply(a, 10)
c =, feed_dict={p: h.handle})