<br />

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

Stops and exports the active trace as a Summary and/or profile file.

    tf.summary.trace_export(
        name, step=None, profiler_outdir=None
    )

### Used in the notebooks

| Used in the guide | Used in the tutorials |
|---|---|
| - [Introduction to modules, layers, and models](https://www.tensorflow.org/guide/intro_to_modules) | - [Examining the TensorFlow Graph](https://www.tensorflow.org/tensorboard/graphs) |

Stops the trace and exports all metadata collected during the trace to the
default SummaryWriter, if one has been set.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `name` | A name for the summary to be written. |
| `step` | Explicit `int64`-castable monotonic step value for this summary. If omitted, this defaults to [`tf.summary.experimental.get_step()`](https://www.tensorflow.org/api_docs/python/tf/summary/experimental/get_step), which must not be None. |
| `profiler_outdir` | This arg is a no-op. Please set this in trace_on(). |

<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/api_docs/python/tf/summary/experimental/get_step) is None. |

<br />