docs: def list_events(self):
      """List all scalar events in the directory.
  
      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)
        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
              event_dir_dict[value.tag].add(dir)
        except tf.errors.DataLossError:
          # DataLossError seems to happen sometimes for small logs.
          # We want to show good records regardless.
          continue
      return dict(event_dir_dict)