Checks if any requirements for trace files are satisfied.
(self)
| 955 | return traced_tensors |
| 956 | |
| 957 | def _check_trace_files(self): |
| 958 | """Checks if any requirements for trace files are satisfied.""" |
| 959 | |
| 960 | if not self._parameters.trace_dir: |
| 961 | # traces will be written to stderr. No need to check trace files. |
| 962 | return |
| 963 | if self._parameters.trace_mode == tensor_tracer_flags.TRACE_MODE_SUMMARY: |
| 964 | # Output files are handled by tf.summary operations, no need to precreate |
| 965 | # them. |
| 966 | return |
| 967 | if _trace_files_need_precreated(self._parameters.trace_dir): |
| 968 | for replica_id in range(0, self._tt_config.num_replicas): |
| 969 | trace_file_path = os.path.join( |
| 970 | self._parameters.trace_dir, |
| 971 | _COMPACT_TRACE_FILE_PREFIX) + '%d'%replica_id |
| 972 | if not gfile.Exists(trace_file_path): |
| 973 | raise RuntimeError( |
| 974 | '%s must be pre-created with the ' |
| 975 | 'appropriate properties.'%trace_file_path) |
| 976 | else: |
| 977 | if not gfile.Exists(self._parameters.trace_dir): |
| 978 | gfile.MkDir(self._parameters.trace_dir) |
| 979 | if not gfile.Exists(self._parameters.trace_dir): |
| 980 | raise RuntimeError('Failed to create %s'%self._parameters.trace_dir) |
| 981 | |
| 982 | def _determine_trace_and_create_report(self, graph, ops_in_exec_path): |
| 983 | """Work needs to be done prior to TPU or CPU tracing. |
no test coverage detected