# tf.summary.SummaryWriter

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/summary_ops_v2.py#L196-L220) |

Interface representing a stateful summary writer object.

## Methods

### `as_default`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/summary_ops_v2.py#L204-L208)

    @abc.abstractmethod
    @tf_contextlib.contextmanager
    as_default()

Returns a context manager that enables summary writing.

### `close`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/summary_ops_v2.py#L218-L220)

    close()

Flushes and closes the summary writer.

### `flush`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/summary_ops_v2.py#L214-L216)

    flush()

Flushes any buffered data.

### `init`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/summary_ops_v2.py#L210-L212)

    init()

Initializes the summary writer.

### `set_as_default`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/summary_ops_v2.py#L199-L202)

    @abc.abstractmethod
    set_as_default()

Enables this summary writer for the current thread.