sherjilozair / char-rnn-tensorflow

Multi-layer Recurrent Neural Networks (LSTM, RNN) for character-level language models in Python using Tensorflow
MIT License
2.64k stars 959 forks source link

2 train steps for a single batch? #104

Open larin92 opened 7 years ago

larin92 commented 7 years ago

Hi,

There are such lines of code at train.py file: trainloss, state, = sess.run([model.cost, model.final_state, model.train_op], feed) summ, trainloss, state, = sess.run([summaries, model.cost, model.final_state, model.train_op], feed)

Means, we run 2 train steps on a single batch. Why?

shy1 commented 7 years ago

directly above the 2nd line you quoted beginning with "summ, train_loss...," is the comment:

# instrument for tensorboard

anytime you see tensorFlow code referring to a summary or summaries, it likely there to facilitate tensorBoard visualization

larin92 commented 7 years ago

Yes, but this can be accomplished in one execution of session.run. It looks like one of those lines should be commented out at a time

GaoleMeng commented 7 years ago

@larin92 Yeah I notice the same problem, I saw someone made a pull request and delete one line. But the pull request is not accepted by the auto code check.