# tf.contrib.summary.graph

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/summary_ops_v2.py#L840-L882) |

Writes a TensorFlow graph to the summary interface.

    tf.contrib.summary.graph(
        param, step=None, name=None
    )

The graph summary is, strictly speaking, not a summary. Conditions
like [`tf.summary.should_record_summaries`](https://www.tensorflow.org/api_docs/python/tf/summary/should_record_summaries) do not apply. Only
a single graph can be associated with a particular run. If multiple
graphs are written, then only the last one will be considered by
TensorBoard.

When not using eager execution mode, the user should consider passing
the `graph` parameter to [`tf.compat.v1.summary.initialize`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/summary/initialize) instead of
calling this function. Otherwise special care needs to be taken when
using the graph to record the graph.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `param` | A [`tf.Tensor`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Tensor) containing a serialized graph proto. When eager execution is enabled, this function will automatically coerce [`tf.Graph`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Graph), [`tf.compat.v1.GraphDef`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/GraphDef), and string types. |
| `step` | The global step variable. This doesn't have useful semantics for graph summaries, but is used anyway, due to the structure of event log files. This defaults to the global step. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The created [`tf.Operation`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Operation) or a [`tf.no_op`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/no_op) if summary writing has not been enabled for this context. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If `param` isn't already a [`tf.Tensor`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Tensor) in graph mode. |

<br />