parameters: ()
return_statement: return result
docstring: Stop current profiling session and return its result.
  
    Returns:
      A binary string of tensorflow.tpu.Trace. User can write the string
      to file for offline analysis by tensorboard.
  
    Raises:
      ProfilerNotRunningError: If there is no active profiling session.
docstring_summary: Stop current profiling session and return its result.
docstring_tokens: Stop current profiling session and return its result .
function: def stop():
    """Stop current profiling session and return its result.
  
    Returns:
      A binary string of tensorflow.tpu.Trace. User can write the string
      to file for offline analysis by tensorboard.
  
    Raises:
      ProfilerNotRunningError: If there is no active profiling session.
    """
    global _profiler
    global _run_num
    with _profiler_lock:
      if _profiler is None:
        raise ProfilerNotRunningError(
            'Cannot stop profiling. No profiler is running.')
      if context.default_execution_mode == context.EAGER_MODE:
        context.context().executor.wait()
      with c_api_util.tf_buffer() as buffer_:
        pywrap_tensorflow.TFE_ProfilerSerializeToString(
            _profiler,
            buffer_)
        result = pywrap_tensorflow.TF_GetBuffer(buffer_)
      pywrap_tensorflow.TFE_DeleteProfiler(_profiler)
      _profiler = None
      _run_num += 1
    return result
function_tokens: def stop ( ) : global _profiler global _run_num with _profiler_lock : if _profiler is None : raise ProfilerNotRunningError ( 'Cannot stop profiling. No profiler is running.' ) if context . default_execution_mode == context . EAGER_MODE : context . context ( ) . executor . wait ( ) with c_api_util . tf_buffer ( ) as buffer_ : pywrap_tensorflow . TFE_ProfilerSerializeToString ( _profiler , buffer_ ) result = pywrap_tensorflow . TF_GetBuffer ( buffer_ ) pywrap_tensorflow . TFE_DeleteProfiler ( _profiler ) _profiler = None _run_num += 1 return result