LostTech.TensorFlow : API Documentation

Type Profiler

Namespace tensorflow.profiler

Parent PythonObjectContainer

Interfaces IProfiler

TensorFlow multi-step profiler.

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/core/profiler/README.md
Show Example
Typical use case:
              # Currently we are only allowed to create 1 profiler per process.
              profiler = Profiler(sess.graph) 

for i in xrange(total_steps): if i % 10000 == 0: run_meta = tf.compat.v1.RunMetadata() _ = sess.run(..., options=tf.compat.v1.RunOptions( trace_level=tf.RunOptions.FULL_TRACE), run_metadata=run_meta) profiler.add_step(i, run_meta)

# Profile the parameters of your model. profiler.profile_name_scope(options=(option_builder.ProfileOptionBuilder .trainable_variables_parameter()))

# Or profile the timing of your model operations. opts = option_builder.ProfileOptionBuilder.time_and_memory() profiler.profile_operations(options=opts)

# Or you can generate a timeline: opts = (option_builder.ProfileOptionBuilder( option_builder.ProfileOptionBuilder.time_and_memory()) .with_step(i) .with_timeline_output(filename).build()) profiler.profile_graph(options=opts) else: _ = sess.run(...) # Auto detect problems and generate advice. profiler.advise()

Methods

Properties

Public instance methods

void add_step(int step, object run_meta)

Add statistics of a step.
Parameters
int step
int, An id used to group one or more different `run_meta` together. When profiling with the profile_xxx APIs, user can use the `step` id in the `options` to profile these `run_meta` together.
object run_meta
RunMetadata proto that contains statistics of a session run.

object add_step_dyn(object step, object run_meta)

Add statistics of a step.
Parameters
object step
int, An id used to group one or more different `run_meta` together. When profiling with the profile_xxx APIs, user can use the `step` id in the `options` to profile these `run_meta` together.
object run_meta
RunMetadata proto that contains statistics of a session run.

object advise(IDictionary<string, object> options)

Automatically detect problems and generate reports.
Parameters
IDictionary<string, object> options
A dict of options. See ALL_ADVICE example above.
Returns
object
A Advise proto that conains the reports from all checkers.

object advise_dyn(object options)

Automatically detect problems and generate reports.
Parameters
object options
A dict of options. See ALL_ADVICE example above.
Returns
object
A Advise proto that conains the reports from all checkers.

object profile_graph(object options)

Profile the statistics of graph nodes, organized by dataflow graph.
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a GraphNodeProto that records the results.

object profile_graph_dyn(object options)

Profile the statistics of graph nodes, organized by dataflow graph.
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a GraphNodeProto that records the results.

object profile_name_scope(IDictionary<string, object> options)

Profile the statistics of graph nodes, organized by name scope.
Parameters
IDictionary<string, object> options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a GraphNodeProto that records the results.

object profile_name_scope_dyn(object options)

Profile the statistics of graph nodes, organized by name scope.
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a GraphNodeProto that records the results.

object profile_operations(object options)

Profile the statistics of the Operation types (e.g. MatMul, Conv2D).
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a MultiGraphNodeProto that records the results.

object profile_operations_dyn(object options)

Profile the statistics of the Operation types (e.g. MatMul, Conv2D).
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a MultiGraphNodeProto that records the results.

object profile_python(object options)

Profile the statistics of the Python codes.

By default, it shows the call stack from root. To avoid redundant output, you may use options to filter as below options['show_name_regexes'] = ['.*my_code.py.*']
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a MultiGraphNodeProto that records the results.

object profile_python_dyn(object options)

Profile the statistics of the Python codes.

By default, it shows the call stack from root. To avoid redundant output, you may use options to filter as below options['show_name_regexes'] = ['.*my_code.py.*']
Parameters
object options
A dict of options. See core/profiler/g3doc/options.md.
Returns
object
a MultiGraphNodeProto that records the results.

object serialize_to_string()

Serialize the ProfileProto to a binary string.

Users can write it to file for offline analysis by tfprof commandline or graphical interface.
Returns
object
ProfileProto binary string.

object serialize_to_string_dyn()

Serialize the ProfileProto to a binary string.

Users can write it to file for offline analysis by tfprof commandline or graphical interface.
Returns
object
ProfileProto binary string.

Public properties

object PythonObject get;