Writes graphs from a RunMetadata summary. Args: name: A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes. data: A RunMetadata proto to write. step: Explicit `int64`-castable monotonic step value for this summary. If
(name, data, step=None)
| 1031 | |
| 1032 | |
| 1033 | def run_metadata_graphs(name, data, step=None): |
| 1034 | """Writes graphs from a RunMetadata summary. |
| 1035 | |
| 1036 | Args: |
| 1037 | name: A name for this summary. The summary tag used for TensorBoard will be |
| 1038 | this name prefixed by any active name scopes. |
| 1039 | data: A RunMetadata proto to write. |
| 1040 | step: Explicit `int64`-castable monotonic step value for this summary. If |
| 1041 | omitted, this defaults to `tf.summary.experimental.get_step()`, which must |
| 1042 | not be None. |
| 1043 | |
| 1044 | Returns: |
| 1045 | True on success, or false if no summary was written because no default |
| 1046 | summary writer was available. |
| 1047 | |
| 1048 | Raises: |
| 1049 | ValueError: if a default writer exists, but no step was provided and |
| 1050 | `tf.summary.experimental.get_step()` is None. |
| 1051 | """ |
| 1052 | summary_metadata = summary_pb2.SummaryMetadata() |
| 1053 | # Hard coding a plugin name. Please refer to go/tb-plugin-name-hardcode for |
| 1054 | # the rationale. |
| 1055 | summary_metadata.plugin_data.plugin_name = "graph_run_metadata_graph" |
| 1056 | # version number = 1 |
| 1057 | summary_metadata.plugin_data.content = b"1" |
| 1058 | |
| 1059 | data = config_pb2.RunMetadata( |
| 1060 | function_graphs=data.function_graphs, |
| 1061 | partition_graphs=data.partition_graphs) |
| 1062 | |
| 1063 | with summary_scope(name, |
| 1064 | "graph_run_metadata_graph_summary", |
| 1065 | [data, step]) as (tag, _): |
| 1066 | with ops.device("cpu:0"): |
| 1067 | tensor = constant_op.constant(data.SerializeToString(), |
| 1068 | dtype=dtypes.string) |
| 1069 | return write( |
| 1070 | tag=tag, |
| 1071 | tensor=tensor, |
| 1072 | step=step, |
| 1073 | metadata=summary_metadata) |
| 1074 | |
| 1075 | |
| 1076 | def keras_model(name, data, step=None): |
no test coverage detected