def A2CLoss(x, log_prob_fn, **unused_kwargs):
  """Definition of the Advantage Actor Critic (A2C) loss."""
  (predictions, actions, advantages, old_log_probs) = x
  del old_log_probs  # Not used in A2C.
  action_log_probs = log_prob_fn(predictions, actions)
  return -(action_log_probs * advantages).mean()