From 81d297f87e367a17ad724f59bf0ce8dff6f5393c Mon Sep 17 00:00:00 2001 From: Jones Wong Date: Thu, 18 Jul 2019 06:11:27 +0800 Subject: [PATCH] Remove redundant scaler of l2 reg (#5172) * remove redundant scaler of l2 reg * lint formatted * Update ddpg_policy.py --- python/ray/rllib/agents/ddpg/ddpg_policy.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/python/ray/rllib/agents/ddpg/ddpg_policy.py b/python/ray/rllib/agents/ddpg/ddpg_policy.py index 5aa1aa710..95e4bd121 100644 --- a/python/ray/rllib/agents/ddpg/ddpg_policy.py +++ b/python/ray/rllib/agents/ddpg/ddpg_policy.py @@ -231,17 +231,15 @@ class DDPGTFPolicy(DDPGPostprocessing, TFPolicy): if config["l2_reg"] is not None: for var in self.policy_vars: if "bias" not in var.name: - self.actor_loss += ( - config["l2_reg"] * 0.5 * tf.nn.l2_loss(var)) + self.actor_loss += (config["l2_reg"] * tf.nn.l2_loss(var)) for var in self.q_func_vars: if "bias" not in var.name: - self.critic_loss += ( - config["l2_reg"] * 0.5 * tf.nn.l2_loss(var)) + self.critic_loss += (config["l2_reg"] * tf.nn.l2_loss(var)) if self.config["twin_q"]: for var in self.twin_q_func_vars: if "bias" not in var.name: self.critic_loss += ( - config["l2_reg"] * 0.5 * tf.nn.l2_loss(var)) + config["l2_reg"] * tf.nn.l2_loss(var)) # update_target_fn will be called periodically to copy Q network to # target Q network