Пример #1
0
 def as_default(self):
     old = context.context().summary_writer_resource
     context.context().summary_writer_resource = self._resource
     yield
     # Flushes the summary writer in eager mode or in graph functions, but not in
     # legacy graph mode (you're on your own there).
     gen_summary_ops.flush_summary_writer(self._resource)
     context.context().summary_writer_resource = old
Пример #2
0
 def as_default(self):
     if self._resource is None:
         yield
     else:
         old = context.context().summary_writer_resource
         context.context().summary_writer_resource = self._resource
         yield
         # Flushes the summary writer in eager mode or in graph functions, but not
         # in legacy graph mode (you're on your own there).
         with ops.device("cpu:0"):
             gen_summary_ops.flush_summary_writer(self._resource)
         context.context().summary_writer_resource = old
Пример #3
0
 def as_default(self):
   if self._resource is None:
     yield
   else:
     old = context.context().summary_writer_resource
     context.context().summary_writer_resource = self._resource
     yield
     # Flushes the summary writer in eager mode or in graph functions, but not
     # in legacy graph mode (you're on your own there).
     with ops.device("cpu:0"):
       gen_summary_ops.flush_summary_writer(self._resource)
     context.context().summary_writer_resource = old
Пример #4
0
def flush(writer=None, name=None):
    """Forces summary writer to send any buffered data to storage.

  This operation blocks until that finishes.

  Args:
    writer: The @{tf.contrib.summary.SummaryWriter} resource to flush.
      The thread default will be used if this parameter is None.
      Otherwise a @{tf.no_op} is returned.
    name: A name for the operation (optional).

  Returns:
    The created @{tf.Operation}.
  """
    if writer is None:
        writer = context.context().summary_writer_resource
        if writer is None:
            return control_flow_ops.no_op()
    return gen_summary_ops.flush_summary_writer(writer, name=name)
Пример #5
0
def flush(writer=None, name=None):
  """Forces summary writer to send any buffered data to storage.

  This operation blocks until that finishes.

  Args:
    writer: The @{tf.contrib.summary.SummaryWriter} resource to flush.
      The thread default will be used if this parameter is None.
      Otherwise a @{tf.no_op} is returned.
    name: A name for the operation (optional).

  Returns:
    The created @{tf.Operation}.
  """
  if writer is None:
    writer = context.context().summary_writer_resource
    if writer is None:
      return control_flow_ops.no_op()
  return gen_summary_ops.flush_summary_writer(writer, name=name)