When I use tensorboard, I find the code:
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
But I can't understand the meaning of this code, I have tried to search the explanation, but failed. Can anyone provide me some detailed materials or explain to me about the metadata and runoptions? What is the purpose of metadata and runoptions?
These options are needed to extract runtime statistics of the graph execution. It adds information about the time of execution and memory consumption to your event files and allow you to see this information in tensorboard.
Basically you define these options and then pass them to sess.run and write them to writer:
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
sess.run(<values_you_want_to_execute>, options=run_options, run_metadata=run_metadata)
your_writer.add_run_metadata(run_metadata, 'step%d' % i)
For more details, read this official guide
1) trace each iteration, e.g. tensorboard > graphs > session runs; 2) metadata also stores information like run times, memory consumption, e.g.
trace_file = open('/home/mk/Documents/timeline.ctf.json', 'w');
trace = timeline.Timeline(step_stats=run_metadata.step_stats);
trace_file.write(trace.generate_chrome_trace_format());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With