Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Invalid description FileWriter #36593

Merged
merged 8 commits into from
Mar 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 11 additions & 12 deletions tensorflow/python/summary/writer/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class FileWriter(SummaryToEventTransformer):

When constructed with a `tf.compat.v1.Session` parameter, a `FileWriter`
instead forms a compatibility layer over new graph-based summaries
(`tf.contrib.summary`) to facilitate the use of new summary writing with
to facilitate the use of new summary writing with
pre-existing code that expects a `FileWriter` instance.

This class is not thread-safe.
Expand Down Expand Up @@ -328,15 +328,11 @@ def __init__(self,
```

The `session` argument to the constructor makes the returned `FileWriter` a
compatibility layer over new graph-based summaries (`tf.contrib.summary`).
compatibility layer over new graph-based summaries (`tf.summary`).
Crucially, this means the underlying writer resource and events file will
be shared with any other `FileWriter` using the same `session` and `logdir`,
and with any `tf.contrib.summary.SummaryWriter` in this session using the
the same shared resource name (which by default scoped to the logdir). If
no such resource exists, one will be created using the remaining arguments
to this constructor, but if one already exists those arguments are ignored.
be shared with any other `FileWriter` using the same `session` and `logdir`.
In either case, ops will be added to `session.graph` to control the
underlying file writer resource. See `tf.contrib.summary` for more details.
underlying file writer resource.

Args:
logdir: A string. Directory where event file will be written.
Expand All @@ -353,14 +349,17 @@ def __init__(self,
RuntimeError: If called with eager execution enabled.

@compatibility(eager)
`FileWriter` is not compatible with eager execution. To write TensorBoard
summaries under eager execution, use `tf.contrib.summary` instead.
`v1.summary.FileWriter` is not compatible with eager execution.
To write TensorBoard summaries under eager execution,
use `tf.summary.create_file_writer` or
a `with v1.Graph().as_default():` context.
@end_compatibility
"""
if context.executing_eagerly():
raise RuntimeError(
"tf.summary.FileWriter is not compatible with eager execution. "
"Use tf.contrib.summary instead.")
"v1.summary.FileWriter is not compatible with eager execution. "
"Use `tf.summary.create_file_writer`,"
"or a `with v1.Graph().as_default():` context")
if session is not None:
event_writer = EventFileWriterV2(
session, logdir, max_queue, flush_secs, filename_suffix)
Expand Down