def compute_match_stats(predictions, labels):
  """Compute statistics that are used to compute evaluation metrics.

  Args:
    predictions: <int32> [batch_size]
    labels: <int32> [batch_size, num_annotators]

  Returns:
    numerator: <float> [batch_size]
    recall_weights: <float> [batch_size]
    precision_weights: <float> [batch_size]
  """
  # <int32> [batch_size, num_labels]
  thresholded_labels = compute_thresholded_labels(labels)
  non_null_mask = tf.greater(thresholded_labels, 0)

  # <bool> [batch_size, num_labels]
  exact_match = tf.equal(tf.expand_dims(predictions, -1), thresholded_labels)
  non_null_match = tf.logical_and(exact_match, non_null_mask)

  # <float> [batch_size]
  non_null_match = tf.to_float(tf.reduce_any(non_null_match, axis=1))
  non_null_gold = tf.to_float(tf.reduce_any(non_null_mask, 1))
  non_null_predictions = tf.to_float(tf.greater(predictions, 0))

  return non_null_match, non_null_gold, non_null_predictions
Compute statistics that are used to compute evaluation metrics.

  Args:
    predictions: <int32> [batch_size]
    labels: <int32> [batch_size, num_annotators]

  Returns:
    numerator: <float> [batch_size]
    recall_weights: <float> [batch_size]
    precision_weights: <float> [batch_size]
  
language/question_answering/decatt_docreader/utils/nq_long_utils.py