class_docstr: Context-manager profile API.
  
  Profiling will start when entering the scope, and stop and save the results to
  the logdir when exits the scope. Open TensorBoard profile tab to view results.
  
  Example usage:
  ```python
  with tf.profiler.experimental.Profile("/path/to/logdir"):
    # do some work
  ```
class_docstr_tok: ["Context-manager","profile","API",".","Profiling","will","start","when","entering","the","scope",",","and","stop","and","save","the","results","to","the","logdir","when","exits","the","scope",".","Open","TensorBoard","profile","tab","to","view","results",".","Example","usage",":","``","`","python","with","tf.profiler.experimental.Profile","(","``","\/path\/to\/logdir","''",")",":","#","do","some","work","``","`"]
docstr: Creates a context manager object for profiler API.
  
  Args:
    logdir: profile data will save to this directory.
    options: An optional `tf.profiler.experimental.ProfilerOptions` can be
      provided to fine tune the profiler's behavior.
docstr_tok: ["Creates","a","context","manager","object","for","profiler","API",".","Args",":","logdir",":","profile","data","will","save","to","this","directory",".","options",":","An","optional","`","tf.profiler.experimental.ProfilerOptions","`","can","be","provided","to","fine","tune","the","profiler","'s","behavior","."]
code: def __init__(self, logdir, options=None):
      """Creates a context manager object for profiler API.
  
      Args:
        logdir: profile data will save to this directory.
        options: An optional `tf.profiler.experimental.ProfilerOptions` can be
          provided to fine tune the profiler's behavior.
      """
      self._logdir = logdir
      self._options = options
  
file_path: tensorflow-upstream/tensorflow/python/profiler/profiler_v2.py
imports: import collections
  import threading
  from tensorflow.python.framework import errors
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.profiler.internal import _pywrap_profiler
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 to create a new Profile object from inherited base classes: object with example: obj = Profile(logdir, options)