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

Function GenerateTestData

tensorboard/scripts/generate_testdata.py:170–217  ·  view source on GitHub ↗

Generates the test data directory.

(path)

Source from the content-addressed store, hash-verified

168
169
170def GenerateTestData(path):
171 """Generates the test data directory."""
172 run1_path = os.path.join(path, "run1")
173 os.makedirs(run1_path)
174 writer1 = tf.summary.FileWriter(run1_path)
175 WriteScalarSeries(writer1, "foo/square", lambda x: x * x)
176 WriteScalarSeries(writer1, "bar/square", lambda x: x * x)
177 WriteScalarSeries(writer1, "foo/sin", math.sin)
178 WriteScalarSeries(writer1, "foo/cos", math.cos)
179 WriteHistogramSeries(
180 writer1, "histo1", [[0, 1], [0.3, 1], [0.5, 1], [0.7, 1], [1, 1]]
181 )
182 WriteImageSeries(writer1, "im1")
183 WriteImageSeries(writer1, "im2")
184 WriteAudioSeries(writer1, "au1")
185
186 run2_path = os.path.join(path, "run2")
187 os.makedirs(run2_path)
188 writer2 = tf.summary.FileWriter(run2_path)
189 WriteScalarSeries(writer2, "foo/square", lambda x: x * x * 2)
190 WriteScalarSeries(writer2, "bar/square", lambda x: x * x * 3)
191 WriteScalarSeries(writer2, "foo/cos", lambda x: math.cos(x) * 2)
192 WriteHistogramSeries(
193 writer2, "histo1", [[0, 2], [0.3, 2], [0.5, 2], [0.7, 2], [1, 2]]
194 )
195 WriteHistogramSeries(
196 writer2, "histo2", [[0, 1], [0.3, 1], [0.5, 1], [0.7, 1], [1, 1]]
197 )
198 WriteImageSeries(writer2, "im1")
199 WriteAudioSeries(writer2, "au2")
200
201 graph_def = tf.compat.v1.GraphDef()
202 node1 = graph_def.node.add()
203 node1.name = "a"
204 node1.op = "matmul"
205 node2 = graph_def.node.add()
206 node2.name = "b"
207 node2.op = "matmul"
208 node2.input.extend(["a:0"])
209
210 writer1.add_graph(graph_def)
211 node3 = graph_def.node.add()
212 node3.name = "c"
213 node3.op = "matmul"
214 node3.input.extend(["a:0", "b:0"])
215 writer2.add_graph(graph_def)
216 writer1.close()
217 writer2.close()
218
219
220def main(unused_argv=None):

Callers 1

mainFunction · 0.85

Calls 9

add_graphMethod · 0.95
WriteScalarSeriesFunction · 0.85
WriteHistogramSeriesFunction · 0.85
WriteImageSeriesFunction · 0.85
WriteAudioSeriesFunction · 0.85
joinMethod · 0.45
makedirsMethod · 0.45
addMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…