(self, **unused_kwargs)
return tl.Serial(
        tl.Fn('LossInput', LossInput, n_out=3),
        # Policy loss is expected to consume
        # (log_probs, advantages, old_log_probs, mask).
        self.policy_loss_given_log_probs,
    )
Policy loss.
Policy loss.
Policy loss .
def policy_loss(self, **unused_kwargs):
    """Policy loss."""
    def LossInput(dist_inputs, actions, advantages, old_dist_inputs):  # pylint: disable=invalid-name
      """Calculates action log probabilities and normalizes advantages."""
      advantages = self._preprocess_advantages(advantages)
      log_probs = self._policy_dist.log_prob(dist_inputs, actions)
      old_log_probs = self._policy_dist.log_prob(old_dist_inputs, actions)
      return (log_probs, advantages, old_log_probs)

    return tl.Serial(
        tl.Fn('LossInput', LossInput, n_out=3),
        # Policy loss is expected to consume
        # (log_probs, advantages, old_log_probs, mask).
        self.policy_loss_given_log_probs,
    )
def policy_loss ( self , * * unused_kwargs ) : def LossInput ( dist_inputs , actions , advantages , old_dist_inputs ) : # pylint: disable=invalid-name """Calculates action log probabilities and normalizes advantages.""" advantages = self . _preprocess_advantages ( advantages ) log_probs = self . _policy_dist . log_prob ( dist_inputs , actions ) old_log_probs = self . _policy_dist . log_prob ( old_dist_inputs , actions ) return ( log_probs , advantages , old_log_probs ) return tl . Serial ( tl . Fn ( 'LossInput' , LossInput , n_out = 3 ) , # Policy loss is expected to consume # (log_probs, advantages, old_log_probs, mask). self . policy_loss_given_log_probs , )