# tf.profiler.write_op_log

<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/profiler/tfprof_logger.py#L191-L218) |

Log provided 'op_log', and add additional model information below.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.profiler.write_op_log`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/profiler/write_op_log)

<br />

    tf.profiler.write_op_log(
        graph, log_dir, op_log=None, run_meta=None, add_trace=True
    )

The API also assigns ops in tf.compat.v1.trainable_variables() an op type
called '_trainable_variables'.
The API also logs 'flops' statistics for ops with op.RegisterStatistics()
defined. flops calculation depends on Tensor shapes defined in 'graph',
which might not be complete. 'run_meta', if provided, completes the shape
information with best effort.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `graph` | tf.Graph. If None and eager execution is not enabled, use default graph. |
| `log_dir` | directory to write the log file. |
| `op_log` | (Optional) OpLogProto proto to be written. If not provided, an new one is created. |
| `run_meta` | (Optional) RunMetadata proto that helps flops computation using run time shape information. |
| `add_trace` | Whether to add python code trace information. Used to support "code" view. |

<br />