Skip to content

TensorFlow keras callback using tensorboard, "ProfilerNotRunningError: Cannot stop profiling. No profiler is running." #2279

@duancaohui

Description

@duancaohui

Environment information (required)

System: Windows 10, RAM 64 GB
Environment: Python 3.6, TensorFlow-gpu==2.0.0-alpha0
GPU: GeForce RTX 2080 Ti, CUDA 10.0, cudnn-10.0-windows10-x64-v7.4.2.24

Issue description

When I try the Guide in https://tensorflow.google.cn/tensorboard/r2/graphs, a mistake is often encountered, such as a simple example:

@tf.function
def my_func(x, y):
    return tf.nn.relu(tf.matmul(x, y))

stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
logdir = os.path.join(PATH,'func',stamp)
writer = tf.summary.create_file_writer(logdir)

x = tf.random.uniform((3, 3))
y = tf.random.uniform((3, 3))

tf.summary.trace_on(graph=True, profiler=True)

z = my_func(x, y)

with writer.as_default():
    tf.summary.trace_export(
        name="my_func_trace",
        step=0,
        profiler_outdir=logdir)

Error description

ProfilerNotRunningError                   Traceback (most recent call last)
<ipython-input-11-c67128fece27> in <module>
     19         name="my_func_trace",
     20         step=0,
---> 21         profiler_outdir=logdir)
     22 

c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\ops\summary_ops_v2.py in trace_export(name, step, profiler_outdir)
   1142 
   1143   if profiler:
-> 1144     _profiler.save(profiler_outdir, _profiler.stop())
   1145 
   1146   trace_off()

c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\eager\profiler.py in stop()
     97     if _profiler is None:
     98       raise ProfilerNotRunningError(
---> 99           'Cannot stop profiling. No profiler is running.')
    100     with c_api_util.tf_buffer() as buffer_:
    101       pywrap_tensorflow.TFE_ProfilerSerializeToString(

ProfilerNotRunningError: Cannot stop profiling. No profiler is running.

I don't know what is issue mean, and how to fix it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions