-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"add tensorflow lstm" #4
Conversation
cost = tf.nn.softmax_cross_entropy_with_logits(prediction, label) | ||
avg_cost = tf.reduce_mean(cost) | ||
adam_optimizer = tf.train.AdamOptimizer(learning_rate=0.002) | ||
train_op = adam_optimizer.minimizer(avg_cost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minimizer => minimize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
initial_state = lstm_cell.zero_state(batch_size, dtype=tf.float32) | ||
outputs, states = rnn.static_rnn( | ||
lstm_cell, lstm_input, dtype=tf.float32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里看着只有一层lstm,可以设置多层stacked的lstm吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
train_reader = paddle.batch( | ||
paddle.reader.shuffle( | ||
paddle.dataset.imdb.train(word_dict), | ||
buf_size=FLAGS.batch_size * 10), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMDB traing set总共25 000,buf_size设置成25000吧,增加buf_size,应该可以加速度reader。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is any difference, and the factor caused by buffer should be removed in our validation scripts.
fix PaddlePaddle/Paddle#6129