import tensorflow as tf

    loss_weight: A float for loss weight.
    distance_fn: A function handle for computing embedding distances, which
      takes two embedding tensors of shape [..., embedding_dim] and returns a
      distance tensor of shape [...].

  Returns:
    loss: A tensor for weighted positive pairwise loss. Shape = [].
    summaries: A dictionary for loss summaries.
  """
  loss = tf.math.reduce_mean(
      distance_fn(anchor_embeddings, positive_embeddings))
  weighted_loss = loss_weight * loss
  summaries = {
      'pairwise_loss/PositivePair/Loss/Original': loss,
      'pairwise_loss/PositivePair/Loss/Weighted': weighted_loss,
      'pairwise_loss/PositivePair/Loss/Weight': tf.constant(loss_weight),
  }
  return weighted_loss, summaries
