tf.compat.v1.summary.FileWriter

View source on GitHub

Writes Summary protocol buffers to event files.

tf.compat.v1.summary.FileWriter(
    logdir, graph=None, max_queue=10, flush_secs=120, graph_def=None,
    filename_suffix=None, session=None
)

The FileWriter class provides a mechanism to create an event file in a given directory and add summaries and events to it. The class updates the file contents asynchronously. This allows a training program to call methods to add data to the file directly from the training loop, without slowing down training.

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 pre-existing code that expects a FileWriter instance.

Args:

Raises:

Methods

__enter__

View source

__enter__()

Make usable with "with" statement.

__exit__

View source

__exit__(
    unused_type, unused_value, unused_traceback
)

Make usable with "with" statement.

add_event

View source

add_event(
    event
)

Adds an event to the event file.

Args:

add_graph

View source

add_graph(
    graph, global_step=None, graph_def=None
)

Adds a Graph to the event file.

The graph described by the protocol buffer will be displayed by TensorBoard. Most users pass a graph in the constructor instead.

Args:

Raises:

add_meta_graph

View source

add_meta_graph(
    meta_graph_def, global_step=None
)

Adds a MetaGraphDef to the event file.

The MetaGraphDef allows running the given graph via saver.import_meta_graph().

Args:

Raises:

add_run_metadata

View source

add_run_metadata(
    run_metadata, tag, global_step=None
)

Adds a metadata information for a single session.run() call.

Args:

Raises:

add_session_log

View source

add_session_log(
    session_log, global_step=None
)

Adds a SessionLog protocol buffer to the event file.

This method wraps the provided session in an Event protocol buffer and adds it to the event file.

Args:

add_summary

View source

add_summary(
    summary, global_step=None
)

Adds a Summary protocol buffer to the event file.

This method wraps the provided summary in an Event protocol buffer and adds it to the event file.

You can pass the result of evaluating any summary op, using tf.Session.run or tf.Tensor.eval, to this function. Alternatively, you can pass a tf.compat.v1.Summary protocol buffer that you populate with your own data. The latter is commonly done to report evaluation results in event files.

Args:

close

View source

close()

Flushes the event file to disk and close the file.

Call this method when you do not need the summary writer anymore.

flush

View source

flush()

Flushes the event file to disk.

Call this method to make sure that all pending events have been written to disk.

get_logdir

View source

get_logdir()

Returns the directory where event file will be written.

reopen

View source

reopen()

Reopens the EventFileWriter.

Can be called after close() to add more events in the same directory. The events will go into a new events file.

Does nothing if the EventFileWriter was not closed.