Conversation
qingqing01
reviewed
Dec 4, 2017
| fc = fluid.layers.fc(input=inputs, size=hid_dim) | ||
| lstm, cell = fluid.layers.dynamic_lstm( | ||
| input=fc, size=hid_dim, is_reverse=(i % 2) == 0) | ||
| inputs = [fc, lstm] |
Collaborator
There was a problem hiding this comment.
The configuration here is not consistent with the config in https://github.com/dzhwinter/benchmark/pull/2/files . There is no reversed LSTM in that PR. Just simple stacked LSTM.
| # data = fluid.layers.data( | ||
| # name="words", shape=[1], append_batch_size=False, dtype="int64") | ||
| # label = fluid.layers.data( | ||
| # name="label", shape=[1], append_batch_size=False, dtype="int64") |
Collaborator
There was a problem hiding this comment.
Remove the unused codes.
| '--use_cprof', action='store_true', help='If set, use cProfile.') | ||
| parser.add_argument( | ||
| '--use_nvprof', | ||
| action='store_false', |
Collaborator
There was a problem hiding this comment.
store_false -> store_true
qingqing01
approved these changes
Dec 5, 2017
| hid_dim = args.hid_dim | ||
| stacked_num = args.stacked_num | ||
|
|
||
| assert stacked_num % 2 == 1, "Must stacked_num %2 == 1." |
| for i in range(stacked_num): | ||
| fc = fluid.layers.fc(input=inputs, size=hid_dim) | ||
| lstm, cell = fluid.layers.dynamic_lstm(input=fc, size=hid_dim) | ||
| inputs = [fc, lstm] |
Collaborator
There was a problem hiding this comment.
inputs = lstm
line 66 67实际可以和line 71 - lin 74行合并。
| fc1 = fluid.layers.fc(input=emb, size=hid_dim) | ||
| lstm1, cell1 = fluid.layers.dynamic_lstm(input=fc1, size=hid_dim) | ||
|
|
||
| inputs = [fc1, lstm1] |
qingqing01
reviewed
Dec 5, 2017
| inputs = [fc, lstm] | ||
|
|
||
| fc_last = fluid.layers.sequence_pool(input=inputs[0], pool_type='max') | ||
| lstm_last = fluid.layers.sequence_pool(input=inputs[1], pool_type='max') |
Collaborator
There was a problem hiding this comment.
只需要对最后的lstm进行pooling即可,line 79只有一个pooling 之后的输入。
意图是为了保持和 https://github.com/dzhwinter/benchmark/blob/master/paddle/understand_sentiment_lstm.py#L74 这里一致。
qingqing01
reviewed
Dec 5, 2017
| train_reader = paddle.batch( | ||
| paddle.reader.shuffle( | ||
| paddle.dataset.imdb.train(word_dict), | ||
| buf_size=args.batch_size * 10), |
Owner
Author
|
all fixed based on comments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix PaddlePaddle/Paddle#6165