return MulLazyVariable(*(list(self.lazy_vars) + list(other.lazy_vars)), matmul_mode=self.matmul_mode)
elif isinstance(other, LazyVariable):
if self.added_diag is not None:
res = list((self, other))
return MulLazyVariable(*res, matmul_mode=self.matmul_mode)
return MulLazyVariable(*(list(self.lazy_vars) + [other]), matmul_mode=self.matmul_mode)
else:
raise RuntimeError("other must be a LazyVariable, int or float.")
After Change
return res
def mul(self, other):
if isinstance(other, int) or isinstance(other, float) or (isinstance(other, Variable) and other.numel() == 1):
lazy_vars = list(self.lazy_vars[:-1])
lazy_vars.append(self.lazy_vars[-1] * other)
return MulLazyVariable(*lazy_vars)
elif isinstance(other, MulLazyVariable):
res = list(self.lazy_vars) + list(other.lazy_vars)
return MulLazyVariable(*res)
elif isinstance(other, LazyVariable):
return MulLazyVariable(*(list(self.lazy_vars) + [other]))
else: