Esempio n. 1
0
  def begin(self):
    self._counters = tf.get_collection("counters")
    if not self._counters:
      return

    if self._summary_writer is None and self._output_dir:
      self._summary_writer = SummaryWriterCache.get(self._output_dir)

    self._last_count = [None for _ in self._counters]
    self._global_step = tf.train.get_global_step()
    if self._global_step is None:
      raise RuntimeError("Global step should be created to use WordCounterHook.")
Esempio n. 2
0
  def begin(self):
    self._counters = tf.get_collection("counters")
    if not self._counters:
      return

    if self._summary_writer is None and self._output_dir:
      self._summary_writer = SummaryWriterCache.get(self._output_dir)

    self._last_count = [None for _ in self._counters]
    self._global_step = tf.train.get_global_step()
    if self._global_step is None:
      raise RuntimeError("Global step should be created to use WordCounterHook.")
Esempio n. 3
0
    def __init__(self, labels_file=None, output_dir=None):
        self._labels_file = labels_file
        self._summary_writer = None

        if output_dir is not None:
            self._summary_writer = SummaryWriterCache.get(output_dir)