import tensorflow as tf


    def merge_prob_dist_for_one_step(self, vocab_dist, attn_dist, p_gen, passage_word_idx, passage_mask=None):
        '''
        max_phrase_size: an input placehoder indications the maximum phrase size inside this batch
        vocab_dist: [batch_size, vsize]
        attn_dist: [batch_size, passage_length]
        p_gen: [batch_size, 1]
        passage_word_idx: [batch_size, passage_length]
        passage_mask: [batch_size, passage_length]
        '''
        input_shape = tf.shape(vocab_dist)
        batch_size = input_shape[0]
        vsize = input_shape[1]
        passage_length = tf.shape(passage_word_idx)[1]

        with tf.variable_scope('final_distribution'):
            vocab_dist = p_gen * vocab_dist
            attn_dist = (1.0-p_gen) * attn_dist

            # Concatenate some zeros to each vocabulary dist, to hold the probabilities for phrases
