Returns:
A dictionary. Key is the name of a event. Value is a set of dirs that contain that event.
event_dir_dict = {}
for event_file in self._glob_events_files(self._paths):
dir = os.path.dirname(event_file)
try:
for record in tf_record.tf_record_iterator(event_file):
event = event_pb2.Event.FromString(record)
if event.summary is None or event.summary.value is None:
continue
for value in event.summary.value:
if value.simple_value is None or value.tag is None:
continue
if value.tag not in event_dir_dict:
event_dir_dict[value.tag] = set()
event_dir_dict[value.tag].add(dir)
except:
// It seems current TF (1.0) has a bug when iterating events from a file near the end.
// For now just catch and pass.
After Change
Returns:
A dictionary. Key is the name of a event. Value is a set of dirs that contain that event.
event_dir_dict = collections.defaultdict(set)
for event_file in self._glob_events_files(self._paths, recursive=True):
dir = os.path.dirname(event_file)
for record in tf_record.tf_record_iterator(event_file):
event = event_pb2.Event.FromString(record)