def METHOD_NAME(self, val, n=1):
    """ update """
    if isinstance(val, paddle.Tensor):
        val = float(val)
    self.val = val
    self.sum += val * n
    self.count += n
    self.avg = self.sum / self.count