TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now


View source on GitHub

Creates a summary file writer in the current context under the given name.



  • logdir: a string, or None. If a string, creates a summary file writer which writes to the directory named by the string. If None, returns a mock object which acts like a summary writer but does nothing, useful to use as a context manager.
  • max_queue: the largest number of summaries to keep in a queue; will flush once the queue gets bigger than this. Defaults to 10.
  • flush_millis: the largest interval between flushes. Defaults to 120,000.
  • filename_suffix: optional suffix for the event file name. Defaults to .v2.
  • name: Shared name for this SummaryWriter resource stored to default Graph. Defaults to the provided logdir prefixed with logdir:. Note: if a summary writer resource with this shared name already exists, the returned SummaryWriter wraps that resource and the other arguments have no effect.


Either a summary writer or an empty object which can be used as a summary writer.