def add_scalars(self, tag_value_dict, global_step=None):
        """

        Args:
            tag_value_dict:
            global_step: None to use the internal counter

        Returns:
            - None if period incomplete
            - dict of {tag: current_value (averaged)} at each period
        """
        for tag, value in tag_value_dict.items():
            if tag in self._history:
                self._history[tag].append(value)
            else:
                self._history[tag] = deque([value], maxlen=self._max_deque_size)
        if self._tracker.track_increment():
            current_values = {}
            for tag, history in self._history.items():
                if self._is_average:
                    history = itertools.islice(
                        history,
                        max(len(history) - self._period, 0),
                        len(history)
                    )  # simulate history[-period:] for deque
                    avg_value = U.mean(list(history))
                else:
                    avg_value = float(history[-1]) if len(history) > 0 else 0.0
                current_values[tag] = avg_value
            if self._tplex is not None:
                if global_step is None:
                    global_step = self._tracker.value
                self._tplex.add_scalars(current_values, global_step)
            return current_values


        Args:
            tag_value_dict:
            global_step: None to use the internal counter

        Returns:
            - None if period incomplete
            - dict of {tag: current_value (averaged)} at each period
        
surreal/session/tracker.py