import tensorflow as tf

    loss: A tensor for triplet loss. Shape = [].
    summaries: A dictionary for loss and batch statistics summaries.
  """

  def maybe_expand_sample_dim(embeddings):
    if len(embeddings.shape.as_list()) == 2:
      return tf.expand_dims(embeddings, axis=-2)
    return embeddings

  anchor_embeddings = maybe_expand_sample_dim(anchor_embeddings)
  positive_embeddings = maybe_expand_sample_dim(positive_embeddings)
  match_embeddings = maybe_expand_sample_dim(match_embeddings)
