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


Python event_accumulator.SCALARS屬性代碼示例

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


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

示例1: testTags

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def testTags(self):
        """Tags should be found in EventAccumulator after adding some
        events."""
        gen = _EventGenerator(self)
        gen.AddScalar("s1")
        gen.AddScalar("s2")
        gen.AddHistogram("hst1")
        gen.AddHistogram("hst2")
        gen.AddImage("im1")
        gen.AddImage("im2")
        gen.AddAudio("snd1")
        gen.AddAudio("snd2")
        acc = ea.EventAccumulator(gen)
        acc.Reload()
        self.assertTagsEqual(
            acc.Tags(),
            {
                ea.IMAGES: ["im1", "im2"],
                ea.AUDIO: ["snd1", "snd2"],
                ea.SCALARS: ["s1", "s2"],
                ea.HISTOGRAMS: ["hst1", "hst2"],
                ea.COMPRESSED_HISTOGRAMS: ["hst1", "hst2"],
            },
        ) 
開發者ID:tensorflow,項目名稱:tensorboard,代碼行數:26,代碼來源:event_accumulator_test.py

示例2: testReload

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def testReload(self):
        """EventAccumulator contains suitable tags after calling Reload."""
        gen = _EventGenerator(self)
        acc = ea.EventAccumulator(gen)
        acc.Reload()
        self.assertTagsEqual(acc.Tags(), {})
        gen.AddScalar("s1")
        gen.AddScalar("s2")
        gen.AddHistogram("hst1")
        gen.AddHistogram("hst2")
        gen.AddImage("im1")
        gen.AddImage("im2")
        gen.AddAudio("snd1")
        gen.AddAudio("snd2")
        acc.Reload()
        self.assertTagsEqual(
            acc.Tags(),
            {
                ea.IMAGES: ["im1", "im2"],
                ea.AUDIO: ["snd1", "snd2"],
                ea.SCALARS: ["s1", "s2"],
                ea.HISTOGRAMS: ["hst1", "hst2"],
                ea.COMPRESSED_HISTOGRAMS: ["hst1", "hst2"],
            },
        ) 
開發者ID:tensorflow,項目名稱:tensorboard,代碼行數:27,代碼來源:event_accumulator_test.py

示例3: testNonValueEvents

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def testNonValueEvents(self):
        """Non-value events in the generator don't cause early exits."""
        gen = _EventGenerator(self)
        acc = ea.EventAccumulator(gen)
        gen.AddScalar("s1", wall_time=1, step=10, value=20)
        gen.AddEvent(
            event_pb2.Event(wall_time=2, step=20, file_version="nots2")
        )
        gen.AddScalar("s3", wall_time=3, step=100, value=1)
        gen.AddHistogram("hst1")
        gen.AddImage("im1")
        gen.AddAudio("snd1")

        acc.Reload()
        self.assertTagsEqual(
            acc.Tags(),
            {
                ea.IMAGES: ["im1"],
                ea.AUDIO: ["snd1"],
                ea.SCALARS: ["s1", "s3"],
                ea.HISTOGRAMS: ["hst1"],
                ea.COMPRESSED_HISTOGRAMS: ["hst1"],
            },
        ) 
開發者ID:tensorflow,項目名稱:tensorboard,代碼行數:26,代碼來源:event_accumulator_test.py

示例4: _collect_metrics

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def _collect_metrics(self):
    self._event_multiplexer.Reload()
    subdir_data = {}
    for i, subdir in enumerate(self._subdirs):
      subdir_metrics = {}

      accum = self._event_multiplexer.GetAccumulator(self._RUN_NAME % i)
      for tag in accum.Tags()[event_accumulator.SCALARS]:
        steps, vals = zip(*[
            (event.step, event.value) for event in accum.Scalars(tag)])
        subdir_metrics[tag] = (steps, vals)

      subdir_data[subdir] = subdir_metrics
    return subdir_data 
開發者ID:akzaidi,項目名稱:fine-lm,代碼行數:16,代碼來源:metrics_hook.py

示例5: assertTagsEqual

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def assertTagsEqual(self, actual, expected):
        """Utility method for checking the return value of the Tags() call.

        It fills out the `expected` arg with the default (empty) values for every
        tag type, so that the author needs only specify the non-empty values they
        are interested in testing.

        Args:
          actual: The actual Accumulator tags response.
          expected: The expected tags response (empty fields may be omitted)
        """

        empty_tags = {
            ea.IMAGES: [],
            ea.AUDIO: [],
            ea.SCALARS: [],
            ea.HISTOGRAMS: [],
            ea.COMPRESSED_HISTOGRAMS: [],
            ea.GRAPH: False,
            ea.META_GRAPH: False,
            ea.RUN_METADATA: [],
            ea.TENSORS: [],
        }

        # Verifies that there are no unexpected keys in the actual response.
        # If this line fails, likely you added a new tag type, and need to update
        # the empty_tags dictionary above.
        self.assertItemsEqual(actual.keys(), empty_tags.keys())

        for key in actual:
            expected_value = expected.get(key, empty_tags[key])
            if isinstance(expected_value, list):
                self.assertItemsEqual(actual[key], expected_value)
            else:
                self.assertEqual(actual[key], expected_value) 
開發者ID:tensorflow,項目名稱:tensorboard,代碼行數:37,代碼來源:event_accumulator_test.py

示例6: testTFSummaryScalar

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def testTFSummaryScalar(self):
        """Verify processing of tf.summary.scalar."""
        event_sink = _EventGenerator(self, zero_out_timestamps=True)
        with test_util.FileWriterCache.get(self.get_temp_dir()) as writer:
            writer.event_writer = event_sink
            with self.test_session() as sess:
                ipt = tf.compat.v1.placeholder(tf.float32)
                tf.compat.v1.summary.scalar("scalar1", ipt)
                tf.compat.v1.summary.scalar("scalar2", ipt * ipt)
                merged = tf.compat.v1.summary.merge_all()
                writer.add_graph(sess.graph)
                for i in xrange(10):
                    summ = sess.run(merged, feed_dict={ipt: i})
                    writer.add_summary(summ, global_step=i)

        accumulator = ea.EventAccumulator(event_sink)
        accumulator.Reload()

        seq1 = [
            ea.ScalarEvent(wall_time=0, step=i, value=i) for i in xrange(10)
        ]
        seq2 = [
            ea.ScalarEvent(wall_time=0, step=i, value=i * i) for i in xrange(10)
        ]

        self.assertTagsEqual(
            accumulator.Tags(),
            {
                ea.SCALARS: ["scalar1", "scalar2"],
                ea.GRAPH: True,
                ea.META_GRAPH: False,
            },
        )

        self.assertEqual(accumulator.Scalars("scalar1"), seq1)
        self.assertEqual(accumulator.Scalars("scalar2"), seq2)
        first_value = accumulator.Scalars("scalar1")[0].value
        self.assertTrue(isinstance(first_value, float)) 
開發者ID:tensorflow,項目名稱:tensorboard,代碼行數:40,代碼來源:event_accumulator_test.py

示例7: Scalars

# 需要導入模塊: from tensorboard.backend.event_processing import event_accumulator [as 別名]
# 或者: from tensorboard.backend.event_processing.event_accumulator import SCALARS [as 別名]
def Scalars(self, tag_name):
        return self._TagHelper(tag_name, event_accumulator.SCALARS) 
開發者ID:tensorflow,項目名稱:tensorboard,代碼行數:4,代碼來源:event_multiplexer_test.py


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