def avg(self, clear=True):
        """
            Get the average of the currently tracked value
        Args:
            @clear: if true (default), clears the cached sum/count
        """
        ans = self.sum / self.count
        if clear:
            self.sum = self.last_val
            self.count = 1
        return ans

            Get the average of the currently tracked value
        Args:
            @clear: if true (default), clears the cached sum/count
        
surreal/utils/common.py