Writes the given caches as tensor summary. Args: step: Step tensor with dimension [num_cores]. **kwargs: The dictionary of tensors that needs to be written as summaries. Key and value pairs within kwargs correspond to the tag name, and tensor content that w
(step, **kwargs)
| 1197 | '--trace_dir=/model/dir') |
| 1198 | |
| 1199 | def _write_cache(step, **kwargs): |
| 1200 | """Writes the given caches as tensor summary. |
| 1201 | |
| 1202 | Args: |
| 1203 | step: Step tensor with dimension [num_cores]. |
| 1204 | **kwargs: The dictionary of tensors that needs to be written as |
| 1205 | summaries. Key and value pairs within kwargs correspond to the tag |
| 1206 | name, and tensor content that will be written using summary.write. |
| 1207 | The trace_modes that use this function are: |
| 1208 | - summary: In summary mode, kwargs includes a single (tag, content) |
| 1209 | pair which are, _TT_SUMMARY_TAG and a tf.float32 signature_cache |
| 1210 | variable. The dimension of the signature_cache is: |
| 1211 | num_cores x num_traced_tensors x num_signatures. |
| 1212 | - full_tensor_summary: kwargs will include all traced tensors. Tag |
| 1213 | and content correspond to the name of the tensor, and its actual |
| 1214 | content. |
| 1215 | Returns: |
| 1216 | A tf.Operation that needs to be executed for the host call dependencies. |
| 1217 | """ |
| 1218 | |
| 1219 | # TODO(deveci): Parametrize max_queue, so that flushing op can be called |
| 1220 | # less frequently. |
| 1221 | # Setting max_queue to 100 appears to be safe even when the number of |
| 1222 | # iterations are much lower, as the destructor of the writer will flushes |
| 1223 | # it. |
| 1224 | summary_write_ops = [] |
| 1225 | with summary.create_file_writer_v2( |
| 1226 | self._parameters.trace_dir, |
| 1227 | filename_suffix=_TT_EVENT_FILE_SUFFIX, |
| 1228 | max_queue=_TT_SUMMARY_MAX_QUEUE).as_default(): |
| 1229 | summary_metadata = summary_pb2.SummaryMetadata( |
| 1230 | plugin_data=summary_pb2.SummaryMetadata.PluginData( |
| 1231 | plugin_name=_TT_TENSORBOARD_PLUGIN_NAME)) |
| 1232 | for key, value in kwargs.items(): |
| 1233 | summary_write_ops.append(summary.write( |
| 1234 | _TT_SUMMARY_TAG + '/' + key, value, metadata=summary_metadata, |
| 1235 | step=step[0])) |
| 1236 | return control_flow_ops.group(summary_write_ops) |
| 1237 | |
| 1238 | step = array_ops.reshape(training_util.get_or_create_global_step(), [1]) |
| 1239 | self._host_call_fn = {} |
nothing calls this directly
no test coverage detected