bert_max_doc_str_max_str_pos_clean_doc_noise_doc/run_doc_qa.py
def compute_answer_string_probs(
                    masked_start_logits, masked_end_logits, start_pos_list,
                    end_pos_list, ans_str_indices, axis=None):
                """Computes the answer string prob given the position logits."""
                start_log_probs = compute_logprob(
                    masked_start_logits, axis=axis
                )
                end_log_probs = compute_logprob(
                    masked_end_logits, axis=axis
                )

                # Note: tf.int32 is required for tf.batch_gather.
                ans_span_start_log_probs = tf.batch_gather(
                    start_log_probs, start_pos_list
                )
                ans_span_end_log_probs = tf.batch_gather(
                    end_log_probs, end_pos_list
                )

                span_probs = tf.exp(ans_span_start_log_probs +
                                    ans_span_end_log_probs)

                # Marginalizes the answer span probabilities.
                # The result probabilities is over answer strings unique in the
                # document.
                str_probs = group_answer_span_prob(
                    span_probs, ans_str_indices
                )

                return str_probs, span_probs
Computes the answer string prob given the position logits.
Computes the answer string prob given the position logits.
Computes the answer string prob given the position logits .
def compute_answer_string_probs(
                    masked_start_logits, masked_end_logits, start_pos_list,
                    end_pos_list, ans_str_indices, axis=None):
                start_log_probs = compute_logprob(
                    masked_start_logits, axis=axis
                )
                end_log_probs = compute_logprob(
                    masked_end_logits, axis=axis
                )
                ans_span_start_log_probs = tf.batch_gather(
                    start_log_probs, start_pos_list
                )
                ans_span_end_log_probs = tf.batch_gather(
                    end_log_probs, end_pos_list
                )
                span_probs = tf.exp(ans_span_start_log_probs +
                                    ans_span_end_log_probs)
                str_probs = group_answer_span_prob(
                    span_probs, ans_str_indices
                )
                return str_probs, span_probs
def compute_answer_string_probs ( masked_start_logits , masked_end_logits , start_pos_list , end_pos_list , ans_str_indices , axis = None ) : start_log_probs = compute_logprob ( masked_start_logits , axis = axis ) end_log_probs = compute_logprob ( masked_end_logits , axis = axis ) ans_span_start_log_probs = tf . batch_gather ( start_log_probs , start_pos_list ) ans_span_end_log_probs = tf . batch_gather ( end_log_probs , end_pos_list ) span_probs = tf . exp ( ans_span_start_log_probs + ans_span_end_log_probs ) str_probs = group_answer_span_prob ( span_probs , ans_str_indices ) return str_probs , span_probs
Computes the answer string prob given the position logits.
Computes the answer string prob given the position logits .
"""Computes the answer string prob given the position logits.""" # Note: tf.int32 is required for tf.batch_gather. # Marginalizes the answer span probabilities. # The result probabilities is over answer strings unique in the # document.
masked_start_logits
masked_end_logits
start_pos_list
end_pos_list
ans_str_indices
axis