當前位置: 首頁>>代碼示例>>Python>>正文


Python SessionLog.STOP屬性代碼示例

本文整理匯總了Python中tensorflow.core.util.event_pb2.SessionLog.STOP屬性的典型用法代碼示例。如果您正苦於以下問題:Python SessionLog.STOP屬性的具體用法?Python SessionLog.STOP怎麽用?Python SessionLog.STOP使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在tensorflow.core.util.event_pb2.SessionLog的用法示例。


在下文中一共展示了SessionLog.STOP屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testSessionLogSummaries

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import STOP [as 別名]
def testSessionLogSummaries(self):
    data = [
        {'session_log': SessionLog(status=SessionLog.START), 'step': 0},
        {'session_log': SessionLog(status=SessionLog.CHECKPOINT), 'step': 1},
        {'session_log': SessionLog(status=SessionLog.CHECKPOINT), 'step': 2},
        {'session_log': SessionLog(status=SessionLog.CHECKPOINT), 'step': 3},
        {'session_log': SessionLog(status=SessionLog.STOP), 'step': 4},
        {'session_log': SessionLog(status=SessionLog.START), 'step': 5},
        {'session_log': SessionLog(status=SessionLog.STOP), 'step': 6},
    ]

    self._WriteScalarSummaries(data)
    units = efi.get_inspection_units(self.logdir)
    self.assertEqual(1, len(units))
    printable = efi.get_dict_to_print(units[0].field_to_obs)
    self.assertEqual(printable['sessionlog:start']['steps'], [0, 5])
    self.assertEqual(printable['sessionlog:stop']['steps'], [4, 6])
    self.assertEqual(printable['sessionlog:checkpoint']['num_steps'], 3) 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:20,代碼來源:event_file_inspector_test.py

示例2: stop

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import STOP [as 別名]
def stop(self, threads=None, close_summary_writer=True):
    """Stop the services and the coordinator.

    This does not close the session.

    Args:
      threads: Optional list of threads to join with the coordinator.  If
        `None`, defaults to the threads running the standard services, the
        threads started for `QueueRunners`, and the threads started by the
        `loop()` method.  To wait on additional threads, pass the
        list in this parameter.
      close_summary_writer: Whether to close the `summary_writer`.  Defaults to
        `True` if the summary writer was created by the supervisor, `False`
        otherwise.
    """
    self._coord.request_stop()
    try:
      # coord.join() re-raises the first reported exception; the "finally"
      # block ensures that we clean up whether or not an exception was
      # reported.
      self._coord.join(threads,
                       stop_grace_period_secs=self._stop_grace_secs)
    finally:
      # Close the writer last, in case one of the running threads was using it.
      if close_summary_writer and self._summary_writer:
        # Stop messages are not logged with event.step,
        # since the session may have already terminated.
        self._summary_writer.add_session_log(SessionLog(status=SessionLog.STOP))
        self._summary_writer.close()
        self._graph_added_to_summary = False 
開發者ID:yuantailing,項目名稱:ctw-baseline,代碼行數:32,代碼來源:supervisor.py

示例3: get_field_to_observations_map

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import STOP [as 別名]
def get_field_to_observations_map(generator, query_for_tag=''):
  """Return a field to `Observations` dict for the event generator.

  Args:
    generator: A generator over event protos.
    query_for_tag: A string that if specified, only create observations for
      events with this tag name.

  Returns:
    A dict mapping keys in `TRACKED_FIELDS` to an `Observation` list.
  """

  def increment(stat, event, tag=''):
    assert stat in TRACKED_FIELDS
    field_to_obs[stat].append(Observation(step=event.step,
                                          wall_time=event.wall_time,
                                          tag=tag)._asdict())

  field_to_obs = dict([(t, []) for t in TRACKED_FIELDS])

  for event in generator:
    ## Process the event
    if event.HasField('graph_def') and (not query_for_tag):
      increment('graph', event)
    if event.HasField('session_log') and (not query_for_tag):
      status = event.session_log.status
      if status == SessionLog.START:
        increment('sessionlog:start', event)
      elif status == SessionLog.STOP:
        increment('sessionlog:stop', event)
      elif status == SessionLog.CHECKPOINT:
        increment('sessionlog:checkpoint', event)
    elif event.HasField('summary'):
      for value in event.summary.value:
        if query_for_tag and value.tag != query_for_tag:
          continue

        for proto_name, display_name in SUMMARY_TYPE_TO_FIELD.items():
          if value.HasField(proto_name):
            increment(display_name, event, value.tag)
  return field_to_obs 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:43,代碼來源:event_file_inspector.py


注:本文中的tensorflow.core.util.event_pb2.SessionLog.STOP屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。