def combined_loss(new_params,
                  old_params,
                  policy_and_value_net_apply,
                  padded_observations,
                  padded_actions,
                  padded_rewards,
                  reward_mask,
                  gamma=0.99,
                  lambda_=0.95,
                  epsilon=0.2,
                  c1=1.0,
                  c2=0.01):
  """Computes the combined (clipped loss + value loss) given observations."""
  log_probab_actions_new, value_predictions = policy_and_value_net_apply(
      padded_observations, new_params)

  log_probab_actions_old, _ = policy_and_value_net_apply(
      padded_observations, old_params)

  # (combined_loss, ppo_loss, value_loss, entropy_bonus)
  return combined_loss_given_predictions(log_probab_actions_new,
                                         log_probab_actions_old,
                                         value_predictions,
                                         padded_actions,
                                         padded_rewards,
                                         reward_mask,
                                         c1=c1,
                                         c2=c2,
                                         gamma=gamma,
                                         lambda_=lambda_,
                                         epsilon=epsilon)