Log provided 'op_log', and add additional model information below. 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
(graph, log_dir, op_log=None, run_meta=None, add_trace=True)
| 190 | |
| 191 | @tf_export(v1=['profiler.write_op_log']) |
| 192 | def write_op_log(graph, log_dir, op_log=None, run_meta=None, add_trace=True): |
| 193 | """Log provided 'op_log', and add additional model information below. |
| 194 | |
| 195 | The API also assigns ops in tf.compat.v1.trainable_variables() an op type |
| 196 | called '_trainable_variables'. |
| 197 | The API also logs 'flops' statistics for ops with op.RegisterStatistics() |
| 198 | defined. flops calculation depends on Tensor shapes defined in 'graph', |
| 199 | which might not be complete. 'run_meta', if provided, completes the shape |
| 200 | information with best effort. |
| 201 | |
| 202 | Args: |
| 203 | graph: tf.Graph. If None and eager execution is not enabled, use |
| 204 | default graph. |
| 205 | log_dir: directory to write the log file. |
| 206 | op_log: (Optional) OpLogProto proto to be written. If not provided, an new |
| 207 | one is created. |
| 208 | run_meta: (Optional) RunMetadata proto that helps flops computation using |
| 209 | run time shape information. |
| 210 | add_trace: Whether to add python code trace information. |
| 211 | Used to support "code" view. |
| 212 | """ |
| 213 | if not graph and not context.executing_eagerly(): |
| 214 | graph = ops.get_default_graph() |
| 215 | op_log = merge_default_with_oplog(graph, op_log, run_meta, add_trace) |
| 216 | |
| 217 | with gfile.Open(os.path.join(log_dir, 'tfprof_log'), 'w') as log: |
| 218 | log.write(op_log.SerializeToString()) |
nothing calls this directly
no test coverage detected