From 5839bd6782be96a4f833dbb9bacaa3919ff61774 Mon Sep 17 00:00:00 2001 From: Lucas Nestler <39779310+ClashLuke@users.noreply.github.com> Date: Mon, 12 May 2025 16:41:24 +0200 Subject: [PATCH] use lerp for polyak updates --- stable_baselines3/common/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stable_baselines3/common/utils.py b/stable_baselines3/common/utils.py index 3790fe3560..96f1529ba4 100644 --- a/stable_baselines3/common/utils.py +++ b/stable_baselines3/common/utils.py @@ -472,9 +472,7 @@ def polyak_update( with th.no_grad(): # zip does not raise an exception if length of parameters does not match. for param, target_param in zip_strict(params, target_params): - target_param.data.mul_(1 - tau) - th.add(target_param.data, param.data, alpha=tau, out=target_param.data) - + target_param.data.lerp_(param.data, tau) def obs_as_tensor(obs: Union[np.ndarray, dict[str, np.ndarray]], device: th.device) -> Union[th.Tensor, TensorDict]: """