MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / get_session_tensor

Function get_session_tensor

tensorflow/python/ops/session_ops.py:183–220  ·  view source on GitHub ↗

Get the tensor of type `dtype` by feeding a tensor handle. This is EXPERIMENTAL and subject to change. Get the value of the tensor from a tensor handle. The tensor is produced in a previous run() and stored in the state of the session. Args: handle: The string representation of a pe

(handle, dtype, name=None)

Source from the content-addressed store, hash-verified

181
182@tf_export(v1=["get_session_tensor"])
183def get_session_tensor(handle, dtype, name=None):
184 """Get the tensor of type `dtype` by feeding a tensor handle.
185
186 This is EXPERIMENTAL and subject to change.
187
188 Get the value of the tensor from a tensor handle. The tensor
189 is produced in a previous run() and stored in the state of the
190 session.
191
192 Args:
193 handle: The string representation of a persistent tensor handle.
194 dtype: The type of the output tensor.
195 name: Optional name prefix for the return tensor.
196
197 Returns:
198 A pair of tensors. The first is a placeholder for feeding a
199 tensor handle and the second is the tensor in the session state
200 keyed by the tensor handle.
201
202 Example:
203
204 ```python
205 c = tf.multiply(a, b)
206 h = tf.compat.v1.get_session_handle(c)
207 h = sess.run(h)
208
209 p, a = tf.compat.v1.get_session_tensor(h.handle, tf.float32)
210 b = tf.multiply(a, 10)
211 c = sess.run(b, feed_dict={p: h.handle})
212 ```
213
214 """
215 handle_device = TensorHandle._get_device_name(handle)
216 with ops.device(handle_device):
217 holder = array_ops.placeholder(dtypes.string)
218 _register_handle_feeder(holder.graph, holder, dtype)
219 tensor = gen_data_flow_ops.get_session_tensor(holder, dtype, name=name)
220 return (holder, tensor)
221
222
223@tf_export(v1=["delete_session_tensor"])

Callers

nothing calls this directly

Calls 4

_register_handle_feederFunction · 0.85
_get_device_nameMethod · 0.80
deviceMethod · 0.45
placeholderMethod · 0.45

Tested by

no test coverage detected