# tf.summary.write

<br />

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

Writes a generic summary to the default SummaryWriter if one exists.

    tf.summary.write(
        tag, tensor, step=None, metadata=None, name=None
    )

This exists primarily to support the definition of type-specific summary ops
like scalar() and image(), and is not intended for direct use unless defining
a new type-specific summary op.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tag` | string tag used to identify the summary (e.g. in TensorBoard), usually generated with `tf.summary.summary_scope` |
| `tensor` | the Tensor holding the summary data to write |
| `step` | Explicit `int64`-castable monotonic step value for this summary. If omitted, this defaults to [`tf.summary.experimental.get_step()`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/summary/experimental/get_step), which must not be None. |
| `metadata` | Optional SummaryMetadata, as a proto or serialized bytes |
| `name` | Optional string name for this op. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| True on success, or false if no summary was written because no default summary writer was available. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | if a default writer exists, but no step was provided and [`tf.summary.experimental.get_step()`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/summary/experimental/get_step) is None. |

<br />