tf.compat.v1.get_session_handle  |  TensorFlow v2.16.1 (original) (raw)

tf.compat.v1.get_session_handle

Stay organized with collections Save and categorize content based on your preferences.

Return the handle of data.

tf.compat.v1.get_session_handle(
    data, name=None
)

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.

Args
data A tensor to be stored in the session.
name Optional name prefix for the return tensor.
Returns
A scalar string tensor representing a unique handle for data.
Raises
TypeError if data is not a Tensor.

Example:

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

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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.