jQwotos / HootMentor

4 stars 0 forks source link

Keeping up with the TF.__newest__version Loop function needed #4

Open Riotpiaole opened 7 years ago

Riotpiaole commented 7 years ago

A future enhancement for adding new loop function replace line 99 to 121 as shell Tensor is no longer iterable IE:

            ##############################  Encoding Stage ####
            for i in range(0, self.n_encode_lstm_step):
                if i > 0:
                    tf.get_variable_scope().reuse_variables()

                with tf.variable_scope("LSTM1"):
                    output1, state1 = self.lstm1(wordvec_emb[:, i, :], state1)

                with tf.variable_scope("LSTM2"):
                    output2, state2 = self.lstm2(tf.concat([padding, output1], 1), state2)

            ############################# Decoding Stage ####
            for i in range(0, self.n_decode_lstm_step):
                with tf.device("/cpu:0"):
                    current_embed = tf.nn.embedding_lookup(self.Wemb, caption[:, i])

                tf.get_variable_scope().reuse_variables()

                with tf.variable_scope("LSTM1"):
                    output1, state1 = self.lstm1(padding, state1)

                with tf.variable_scope("LSTM2"):
                    output2, state2 = self.lstm2(tf.concat([current_embed, output1], 1), state2)