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

Method test_scalar

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

Source from the content-addressed store, hash-verified

56 self.assertEqual(original_pbtxt, value.SerializeToString())
57
58 def test_scalar(self):
59 with tf.compat.v1.Graph().as_default():
60 old_op = tf.compat.v1.summary.scalar(
61 "important_constants", tf.constant(0x5F3759DF)
62 )
63 old_value = self._value_from_op(old_op)
64 assert old_value.HasField("simple_value"), old_value
65 new_value = data_compat.migrate_value(old_value)
66
67 self.assertEqual("important_constants", new_value.tag)
68 expected_metadata = scalar_metadata.create_summary_metadata(
69 display_name="important_constants", description=""
70 )
71 self.assertEqual(expected_metadata, new_value.metadata)
72 self.assertTrue(new_value.HasField("tensor"))
73 data = tensor_util.make_ndarray(new_value.tensor)
74 self.assertEqual((), data.shape)
75 low_precision_value = np.array(0x5F3759DF).astype("float32").item()
76 self.assertEqual(low_precision_value, data.item())
77
78 def test_audio(self):
79 with tf.compat.v1.Graph().as_default():

Callers

nothing calls this directly

Calls 3

_value_from_opMethod · 0.95
GraphMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected