(self)
return tl.Fn('AWRJointLoss', f)
Joint policy and value loss.
Joint policy and value loss.
Joint policy and value loss .
def joint_loss(self):
    """Joint policy and value loss."""

    def f(preds, values, returns, actions, mask):
      advantages = jnp.squeeze(returns - stop_gradient(values), axis=-1)
      logps = self._policy_dist.log_prob(preds, actions)
      awr_loss = actor_critic.AWRLoss(
          beta=self._beta, w_max=self._w_max, thresholds=self._thresholds)(
              (logps, advantages, jnp.zeros_like(logps), mask))
      l2_value_loss = jnp.mean((returns - values)**2) * self._value_loss_coeff
      return awr_loss + l2_value_loss
    return tl.Fn('AWRJointLoss', f)
def joint_loss ( self ) : def f ( preds , values , returns , actions , mask ) : advantages = jnp . squeeze ( returns - stop_gradient ( values ) , axis = - 1 ) logps = self . _policy_dist . log_prob ( preds , actions ) awr_loss = actor_critic . AWRLoss ( beta = self . _beta , w_max = self . _w_max , thresholds = self . _thresholds ) ( ( logps , advantages , jnp . zeros_like ( logps ) , mask ) ) l2_value_loss = jnp . mean ( ( returns - values ) ** 2 ) * self . _value_loss_coeff return awr_loss + l2_value_loss return tl . Fn ( 'AWRJointLoss' , f )