def __init__(self,
               path,
               size_guidance=None,
               tensor_size_guidance=None,
               purge_orphaned_data=True):
    """Construct the `EventAccumulator`.

    Args:
      path: A file path to a directory containing tf events files, or a single
        tf events file. The accumulator will load events from this path.
      size_guidance: Information on how much data the EventAccumulator should
        store in memory. The DEFAULT_SIZE_GUIDANCE tries not to store too much
        so as to avoid OOMing the client. The size_guidance should be a map
        from a `tagType` string to an integer representing the number of
        items to keep per tag for items of that `tagType`. If the size is 0,
        all events are stored.
      tensor_size_guidance: Like `size_guidance`, but allowing finer
        granularity for tensor summaries. Should be a map from the
        `plugin_name` field on the `PluginData` proto to an integer
        representing the number of items to keep per tag. Plugins for
        which there is no entry in this map will default to the value of
        `size_guidance[event_accumulator.TENSORS]`. Defaults to `{}`.
      purge_orphaned_data: Whether to discard any events that were "orphaned" by
        a TensorFlow restart.
    """
    size_guidance = dict(size_guidance or DEFAULT_SIZE_GUIDANCE)
    sizes = {}
    for key in DEFAULT_SIZE_GUIDANCE:
      if key in size_guidance:
        sizes[key] = size_guidance[key]
      else:
        sizes[key] = DEFAULT_SIZE_GUIDANCE[key]
    self._size_guidance = size_guidance
    self._tensor_size_guidance = dict(tensor_size_guidance or {})

    self._first_event_timestamp = None

    self._graph = None
    self._graph_from_metagraph = False
    self._meta_graph = None
    self._tagged_metadata = {}
    self.summary_metadata = {}
    self.tensors_by_tag = {}
    self._tensors_by_tag_lock = threading.Lock()

    # Keep a mapping from plugin name to a dict mapping from tag to plugin data
    # content obtained from the SummaryMetadata (metadata field of Value) for
    # that plugin (This is not the entire SummaryMetadata proto - only the
    # content for that plugin). The SummaryWriter only keeps the content on the
    # first event encountered per tag, so we must store that first instance of
    # content for each tag.
    self._plugin_to_tag_to_content = collections.defaultdict(dict)
    self._plugin_tag_locks = collections.defaultdict(threading.Lock)

    self.path = path
    self._generator = _GeneratorFromPath(path)
    self._generator_mutex = threading.Lock()

    self.purge_orphaned_data = purge_orphaned_data

    self.most_recent_step = -1
    self.most_recent_wall_time = -1
    self.file_version = None
def __init__ ( self , path , size_guidance = None , tensor_size_guidance = None , purge_orphaned_data = True ) : size_guidance = dict ( size_guidance or DEFAULT_SIZE_GUIDANCE ) sizes = { } for key in DEFAULT_SIZE_GUIDANCE : if key in size_guidance : sizes [ key ] = size_guidance [ key ] else : sizes [ key ] = DEFAULT_SIZE_GUIDANCE [ key ] self . _size_guidance = size_guidance self . _tensor_size_guidance = dict ( tensor_size_guidance or { } ) self . _first_event_timestamp = None self . _graph = None self . _graph_from_metagraph = False self . _meta_graph = None self . _tagged_metadata = { } self . summary_metadata = { } self . tensors_by_tag = { } self . _tensors_by_tag_lock = threading . Lock ( ) self . _plugin_to_tag_to_content = collections . defaultdict ( dict ) self . _plugin_tag_locks = collections . defaultdict ( threading . Lock ) self . path = path self . _generator = _GeneratorFromPath ( path ) self . _generator_mutex = threading . Lock ( ) self . purge_orphaned_data = purge_orphaned_data self . most_recent_step = - 1 self . most_recent_wall_time = - 1 self . file_version = None
Construct the `EventAccumulator`.

    Args:
      path: A file path to a directory containing tf events files, or a single
        tf events file. The accumulator will load events from this path.
      size_guidance: Information on how much data the EventAccumulator should
        store in memory. The DEFAULT_SIZE_GUIDANCE tries not to store too much
        so as to avoid OOMing the client. The size_guidance should be a map
        from a `tagType` string to an integer representing the number of
        items to keep per tag for items of that `tagType`. If the size is 0,
        all events are stored.
      tensor_size_guidance: Like `size_guidance`, but allowing finer
        granularity for tensor summaries. Should be a map from the
        `plugin_name` field on the `PluginData` proto to an integer
        representing the number of items to keep per tag. Plugins for
        which there is no entry in this map will default to the value of
        `size_guidance[event_accumulator.TENSORS]`. Defaults to `{}`.
      purge_orphaned_data: Whether to discard any events that were "orphaned" by
        a TensorFlow restart.