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


Python SessionLog.CHECKPOINT屬性代碼示例

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


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

示例1: testSessionLogSummaries

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [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: run_loop

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def run_loop(self):
    logging.info("Saving checkpoint to path %s", self._sv.save_path)
    self._sv.saver.save(self._sess, self._sv.save_path,
                        global_step=self._sv.global_step)
    if self._sv.summary_writer and self._sv.global_step is not None:
      current_step = training_util.global_step(self._sess, self._sv.global_step)
      self._sv.summary_writer.add_session_log(
          SessionLog(status=SessionLog.CHECKPOINT,
                     checkpoint_path=self._sv.save_path),
          current_step)


# TODO(sherrym): All non-PEP8 compliant names will be deprecated shortly. 
開發者ID:yuantailing,項目名稱:ctw-baseline,代碼行數:15,代碼來源:supervisor.py

示例3: _save

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def _save(self, step, session):
    """Saves the latest checkpoint."""
    logging.info("Saving checkpoints for %d into %s.", step, self._save_path)

    for l in self._listeners:
      l.before_save(session, step)

    self._get_saver().save(session, self._save_path, global_step=step)
    self._summary_writer.add_session_log(
        SessionLog(
            status=SessionLog.CHECKPOINT, checkpoint_path=self._save_path),
        step)

    for l in self._listeners:
      l.after_save(session, step) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:17,代碼來源:basic_session_run_hooks.py

示例4: get_field_to_observations_map

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [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

示例5: _save

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def _save(self, step, session):
    """Saves the latest checkpoint."""
    if step == self._last_saved_step:
      return
    logging.info("Saving checkpoints for %d into %s.", step, self._save_path)
    self._last_saved_time = time.time()
    self._last_saved_step = step
    if self._saver is None:
      self._scaffold.saver.save(session, self._save_path, global_step=step)
    else:
      self._saver.save(session, self._save_path, global_step=step)
    self._summary_writer.add_session_log(
        SessionLog(
            status=SessionLog.CHECKPOINT, checkpoint_path=self._save_path),
        step) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:17,代碼來源:monitors.py

示例6: run_loop

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def run_loop(self):
    self._sv.saver.save(self._sess, self._sv.save_path,
                        global_step=self._sv.global_step)
    if self._sv.summary_writer and self._sv.global_step is not None:
      current_step = training_util.global_step(self._sess, self._sv.global_step)
      self._sv.summary_writer.add_session_log(
          SessionLog(status=SessionLog.CHECKPOINT,
                     checkpoint_path=self._sv.save_path),
          current_step)


# TODO(sherrym): All non-PEP8 compliant names will be deprecated shortly. 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:14,代碼來源:supervisor.py

示例7: _save

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def _save(self, session, step, asynchronous=True):
    """Saves the latest checkpoint, returns should_stop."""

    def _save_fn():
      """Run the saver process."""
      logging.info("Saving checkpoints for %d into %s.", step, self._save_path)

      start_time = time.time()
      for l in self._listeners:
        l.before_save(session, step)

      self._get_saver().save(session, self._save_path, global_step=step)
      self._summary_writer.add_session_log(
          SessionLog(
              status=SessionLog.CHECKPOINT, checkpoint_path=self._save_path),
          step)
      end_time = time.time()
      logging.info("Checkpoint actual writing time: (%.3f sec)",
                   end_time - start_time)
      logging.info("Checkpoint finished for %d into %s.", step, self._save_path)

    for l in self._listeners:
      l.before_save(session, step)

    if not asynchronous:
      _save_fn()
      return

    if self._save_thread is not None:
      self._save_thread.join(timeout=0.1)
      if self._save_thread.is_alive():
        logging.info("Saver thread still in progress, skipping checkpoint.")
        return

    self._save_thread = threading.Thread(target=_save_fn)
    self._save_thread.start() 
開發者ID:mlperf,項目名稱:training_results_v0.5,代碼行數:38,代碼來源:async_checkpoint.py

示例8: _save

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def _save(self, step, session):
    """Saves the latest checkpoint."""
    logging.info("Saving checkpoints for %d into %s.", step, self._save_path)
    if self._saver is not None:
      self._saver.save(session, self._save_path, global_step=step)
    elif self._scaffold is not None:
      self._scaffold.saver.save(session, self._save_path, global_step=step)
    self._summary_writer.add_session_log(
        SessionLog(
            status=SessionLog.CHECKPOINT, checkpoint_path=self._save_path),
        step) 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:13,代碼來源:basic_session_run_hooks.py

示例9: _save

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def _save(self, step, session):
        """ Saves checkpoints.

        Args:
            step: A python integer, running step.
            session: A TensorFlow Session.
        """
        """Saves the latest checkpoint."""
        self._saver.save(session, self._save_path, global_step=step)
        tf.logging.info("Saving checkpoints for {} into {}".format(step, self._save_path))
        if self._summary_writer is not None:
            self._summary_writer.add_session_log(
                SessionLog(
                    status=SessionLog.CHECKPOINT, checkpoint_path=self._save_path),
                step) 
開發者ID:zhaocq-nlp,項目名稱:NJUNMT-tf,代碼行數:17,代碼來源:hooks.py

示例10: _save

# 需要導入模塊: from tensorflow.core.util.event_pb2 import SessionLog [as 別名]
# 或者: from tensorflow.core.util.event_pb2.SessionLog import CHECKPOINT [as 別名]
def _save(self, session, step):
    """Saves the latest checkpoint."""
    logging.info("Saving checkpoints for %d into %s.", step, self._save_path)

    for l in self._listeners:
      l.before_save(session, step)

    self._get_saver().save(session, self._save_path, global_step=step)
    self._summary_writer.add_session_log(
        SessionLog(
            status=SessionLog.CHECKPOINT, checkpoint_path=self._save_path),
        step)

    for l in self._listeners:
      l.after_save(session, step) 
開發者ID:PacktPublishing,項目名稱:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代碼行數:17,代碼來源:basic_session_run_hooks.py


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