def _attend_to_question(context_emb, question_emb, question_mask, hidden_size):
  """Compute similarity scores with the dot product of two linear layers.

  Args:
    context_emb: <float32> [batch_size, max_context_len, hidden_size]
    question_emb: <float32> [batch_size, max_question_len, hidden_size]
    question_mask: <float32> [batch_size, max_question_len]
    hidden_size: Integer indicating the size of the projection.

  Returns:
    attended_emb: <float32> [batch_size, max_context_len, hidden_size]
  """
  with tf.variable_scope("question_projection"):
    # [batch_size, max_question_len, hidden_size]
    projected_question_emb = tf.layers.dense(question_emb, hidden_size)
  with tf.variable_scope("context_projection"):
    # [batch_size, max_context_len, hidden_size]
    projected_context_emb = tf.layers.dense(context_emb, hidden_size)

  # [batch_size, max_context_len, max_question_len]
  attention_scores = tf.matmul(
      projected_context_emb, projected_question_emb, transpose_b=True)
  attention_scores += tf.expand_dims(tf.log(question_mask), 1)
  attention_weights = tf.nn.softmax(attention_scores)

  # [batch_size, max_context_len, hidden_size]
  attended_emb = tf.matmul(attention_weights, question_emb)
  return attended_emb
Compute similarity scores with the dot product of two linear layers.

  Args:
    context_emb: <float32> [batch_size, max_context_len, hidden_size]
    question_emb: <float32> [batch_size, max_question_len, hidden_size]
    question_mask: <float32> [batch_size, max_question_len]
    hidden_size: Integer indicating the size of the projection.

  Returns:
    attended_emb: <float32> [batch_size, max_context_len, hidden_size]
  
language/question_answering/decatt_docreader/layers/document_reader.py