Open
Description
Feature added in tensorflow/tensorflow#35340,
but I have no evidence that it ever worked (it has no tests, and is
broken in TensorFlow 2.2.0 through head). Simple repro:
import tensorflow as tf
writer = tf.summary.create_file_writer("logs")
with writer.as_default():
tf.summary.trace_on(profiler=True)
tf.summary.trace_export("test", step=0)
The last line fails with:
Traceback (most recent call last):
File "test.py", line 6, in <module>
tf.summary.trace_export("test", step=0)
File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20201214-py3.8/lib/python3.8/site-packages/tensorflow/python/ops/summary_ops_v2.py", line 1314, in trace_export
_profiler.save(profiler_outdir, _profiler.stop())
File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20201214-py3.8/lib/python3.8/site-packages/tensorflow/python/util/deprecation.py", line 337, in new_func
return func(*args, **kwargs)
File "/usr/local/google/home/wchargin/virtualenv/tf-nightly-20201214-py3.8/lib/python3.8/site-packages/tensorflow/python/eager/profiler.py", line 147, in save
plugin_dir = os.path.join(
File "/usr/lib/python3.8/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not tensorflow.python.framework.ops.EagerTensor
(The error is slightly different in TensorFlow 2.2.0 on Python 3.5, but
that’s just because of the Python version difference.)
Stepping with pdb shows that logdir
on line R1234 of that PR is set
to <tf.Tensor: shape=(), dtype=string, numpy=b'logs'>
, which
explains why the later call to os.path.join(logdir, ...)
would fail in
the internals of _profiler.save
.