Exemplo n.º 1
0
def _get_handle_deleter(graph, deleter_key, handle):
    """Return a deletion subgraph for this handle."""
    result = graph._handle_deleters.get(deleter_key)
    if result is None:
        # Create deleter if we haven't done it.
        handle_device = TensorHandle._get_device_name(handle)
        with graph.as_default(), graph.device(handle_device):
            holder = array_ops.placeholder(dtypes.string)
            deleter = gen_data_flow_ops._delete_session_tensor(holder)
        result = (holder, deleter)
        graph._handle_deleters[deleter_key] = result
    return result
Exemplo n.º 2
0
def _get_handle_deleter(graph, deleter_key, handle):
  """Return a deletion subgraph for this handle."""
  result = graph._handle_deleters.get(deleter_key)
  if result is None:
    # Create deleter if we haven't done it.
    handle_device = TensorHandle._get_device_name(handle)
    with graph.as_default(), graph.device(handle_device):
      holder = array_ops.placeholder(dtypes.string)
      deleter = gen_data_flow_ops._delete_session_tensor(holder)
    result = (holder, deleter)
    graph._handle_deleters[deleter_key] = result
  return result
Exemplo n.º 3
0
def delete_session_tensor(name=None):
    """Delete the tensor by feeding a tensor handle.

  This is EXPERIMENTAL and subject to change.

  Delete the tensor of a given tensor handle. The tensor is produced
  in a previous run() and stored in the state of the session.

  Args:
    name: Optional name prefix for the return tensor.

  Returns:
    A pair of graph elements. The first is a placeholder for feeding a
    tensor handle and the second is a deletion operation.
  """
    with ops.device(None):
        # We will commit the device at the time it is used.
        holder = array_ops.placeholder(dtypes.string)
    deleter = gen_data_flow_ops._delete_session_tensor(holder, name=name)
    return (holder, deleter)
def delete_session_tensor(name=None):
    """Delete the tensor by feeding a tensor handle.

  This is EXPERIMENTAL and subject to change.

  Delete the tensor of a given tensor handle. The tensor is produced
  in a previous run() and stored in the state of the session.

  Args:
    name: Optional name prefix for the return tensor.

  Returns:
    A pair of graph elements. The first is a placeholder for feeding a
    tensor handle and the second is a deletion operation.
  """
    with ops.device(None):
        # We will commit the device at the time it is used.
        holder = array_ops.placeholder(dtypes.string)
    deleter = gen_data_flow_ops._delete_session_tensor(holder, name=name)
    return (holder, deleter)
Exemplo n.º 5
0
def delete_session_tensor(handle, name=None):
  """Delete the tensor for the given tensor handle.

  This is EXPERIMENTAL and subject to change.

  Delete the tensor of a given 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 persistent tensor handle.
    name: Optional name prefix for the return tensor.

  Returns:
    A pair of graph elements. The first is a placeholder for feeding a
    tensor handle and the second is a deletion operation.
  """
  handle_device = TensorHandle._get_device_name(handle)
  with ops.device(handle_device):
    holder = array_ops.placeholder(dtypes.string)
    deleter = gen_data_flow_ops._delete_session_tensor(holder, name=name)
  return (holder, deleter)
Exemplo n.º 6
0
def delete_session_tensor(handle, name=None):
    """Delete the tensor for the given tensor handle.

  This is EXPERIMENTAL and subject to change.

  Delete the tensor of a given 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 persistent tensor handle.
    name: Optional name prefix for the return tensor.

  Returns:
    A pair of graph elements. The first is a placeholder for feeding a
    tensor handle and the second is a deletion operation.
  """
    handle_device = TensorHandle._get_device_name(handle)
    with ops.device(handle_device):
        holder = array_ops.placeholder(dtypes.string)
        deleter = gen_data_flow_ops._delete_session_tensor(holder, name=name)
    return (holder, deleter)