def _get_position_scores(batch_size, num_contexts, max_pos_embs, pos_emb_dim):
  """Get scores that only depend on position.

  Args:
    batch_size: <int32> []
    num_contexts: <int32> []
    max_pos_embs: <int32> for max number of contexts that get a unique embedding
      (all contexts above this number are mapped to the same embedding).
    pos_emb_dim: <int32>  for position embedding dimension.

  Returns:
    <float32> [batch_size, num_contexts, pos_emb_dim] for position embeddings.
  """
  pos_embedding_params = tf.get_variable(
      name="position_embeddings",
      shape=[max_pos_embs, pos_emb_dim],
      trainable=True)

  # <int32> [num_contexts]
  context_pos = tf.range(0, num_contexts)
  context_pos = tf.clip_by_value(
      t=context_pos, clip_value_min=-1, clip_value_max=max_pos_embs - 1)

  # <float> [num_contexts, pos_emb_dim]
  pos_embs = tf.nn.embedding_lookup(
      params=pos_embedding_params, ids=context_pos, partition_strategy="div")

  # <float> [batch_size, num_contexts, pos_emb_dim]
  pos_embs = tf.tile(tf.expand_dims(pos_embs, 0), [batch_size, 1, 1])
  return pos_embs
Get scores that only depend on position.

  Args:
    batch_size: <int32> []
    num_contexts: <int32> []
    max_pos_embs: <int32> for max number of contexts that get a unique embedding
      (all contexts above this number are mapped to the same embedding).
    pos_emb_dim: <int32>  for position embedding dimension.

  Returns:
    <float32> [batch_size, num_contexts, pos_emb_dim] for position embeddings.
  
language/question_answering/decatt_docreader/models/nq_long_decatt_model.py