def compute_qa_rewards(
    question_ids,
    question_mask,
    context_ids,
    context_mask,
    answer_ids,
    answer_mask,
    rc_model,
    vocab,
    max_answer_length=10,
    no_answer_bias=0.0,
):
  """Compute all QA-based rewards.

  Args:
    question_ids: <int32> [batch_size, question_length]
    question_mask: <int32> [batch_size, question_length]
    context_ids: <int32> [batch_size, context_length]
    context_mask: <int32> [batch_size, context_length]
    answer_ids: <int32> [batch_size, answer_length]
    answer_mask: <int32> [batch_size, answer_length]
    rc_model: TF Hub module for extractive QA.
    vocab: Instance of text_utils.Vocab.
    max_answer_length: Maximum span length to predict.
    no_answer_bias: Log-odds threshold for answering a span over NULL.

  Returns:
    rewards: A dictionary with indicator, exact match, F1 scores,
             and predicted span information (ids and logits).
  """
  rewards = {}
  rewards["indicator"] = indicator_score(
      answer_ids=answer_ids,
      answer_mask=answer_mask,
      context_ids=context_ids,
      vocab=vocab)
  span_ids, span_scores = rc_span(
      question_ids=question_ids,
      question_mask=question_mask,
      context_ids=context_ids,
      context_mask=context_mask,
      rc_model=rc_model,
      vocab=vocab,
      max_length=max_answer_length,
      no_answer_bias=no_answer_bias)
  rewards["span_ids"] = span_ids
  rewards["span_scores"] = span_scores
  rewards["exact_match"] = exact_match(
      answer_ids=answer_ids, prediction_ids=span_ids, vocab=vocab)
  rewards["f1_score"] = f1_score(
      answer_ids=answer_ids, prediction_ids=span_ids, vocab=vocab)
  return rewards
Compute all QA-based rewards.

  Args:
    question_ids: <int32> [batch_size, question_length]
    question_mask: <int32> [batch_size, question_length]
    context_ids: <int32> [batch_size, context_length]
    context_mask: <int32> [batch_size, context_length]
    answer_ids: <int32> [batch_size, answer_length]
    answer_mask: <int32> [batch_size, answer_length]
    rc_model: TF Hub module for extractive QA.
    vocab: Instance of text_utils.Vocab.
    max_answer_length: Maximum span length to predict.
    no_answer_bias: Log-odds threshold for answering a span over NULL.

  Returns:
    rewards: A dictionary with indicator, exact match, F1 scores,
             and predicted span information (ids and logits).
  
language/capwap/utils/reward_utils.py