How about this? S2 = (1 - self.reg_param)*S2 + self.reg_param