MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / test_histogram

Method test_histogram

tensorboard/data_compat_test.py:188–209  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

186 )
187
188 def test_histogram(self):
189 with tf.compat.v1.Graph().as_default():
190 old_op = tf.compat.v1.summary.histogram(
191 "important_data", tf.random.normal(shape=[23, 45])
192 )
193 old_value = self._value_from_op(old_op)
194 assert old_value.HasField("histo"), old_value
195 new_value = data_compat.migrate_value(old_value)
196
197 self.assertEqual("important_data", new_value.tag)
198 expected_metadata = histogram_metadata.create_summary_metadata(
199 display_name="important_data", description=""
200 )
201 self.assertEqual(expected_metadata, new_value.metadata)
202 self.assertTrue(new_value.HasField("tensor"))
203 buckets = tensor_util.make_ndarray(new_value.tensor)
204 for bucket in buckets:
205 # No `backwards` buckets.
206 self.assertLessEqual(bucket[0], bucket[1])
207 self.assertEqual(old_value.histo.min, buckets[0][0])
208 self.assertEqual(old_value.histo.max, buckets[-1][1])
209 self.assertEqual(23 * 45, buckets[:, 2].astype(int).sum())
210
211 def test_empty_histogram(self):
212 with tf.compat.v1.Graph().as_default():

Callers

nothing calls this directly

Calls 3

_value_from_opMethod · 0.95
GraphMethod · 0.45
histogramMethod · 0.45

Tested by

no test coverage detected