import tensorflow as tf

                extra_zeros = tf.zeros((batch_size, self.max_phrase_size))
                vocab_dist = tf.concat(values=[vocab_dist, extra_zeros], axis=1) # [batch_size, extended_vsize]
                if self.options.add_first_word_prob_for_phrase: # add prob of the first word to each phrase
                    attn_dist = add_first_word_prob_to_atten_dists(self.in_passage_words, self.phrase_starts,
                                                                   vocab_dist, attn_dist)

            # match attn_dist[batch_size, passage_length] to sparse one-hot representation [batch_size, passage_length, extended_vsize]
            batch_nums = tf.range(0, limit=batch_size) # shape (batch_size)
            batch_nums = tf.expand_dims(batch_nums, axis=1) # shape (batch_size, 1)
            batch_nums = tf.tile(batch_nums, [1, passage_length]) # shape (batch_size, passage_length)
            step_nums = tf.range(0, limit=passage_length) # [passage_length]
            step_nums = tf.expand_dims(step_nums, axis=0) # shape (1, passage_length)
            step_nums = tf.tile(step_nums, [batch_size, 1]) # shape (batch_size, passage_length)
            indices = tf.stack((batch_nums, step_nums, passage_word_idx), axis=2) # shape (batch_size, passage_length, 3)
            indices = tf.reshape(indices, [-1, 3]) #[batch_size * passage_length, 3]
            indices = tf.cast(indices, tf.int64)

            shape = [batch_size, passage_length, extended_vsize]
