-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Fix the model in test_machine_translation.py. #7770
Conversation
size=hidden_size * 4, | ||
act='tanh', | ||
bias_attr=True) | ||
reversed, _ = fluid.layers.dynamic_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.
reversed -->backward.
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
size=hidden_size * 4, | ||
is_reverse=True, | ||
use_peepholes=USE_PEEPHOLES) | ||
return forward, reversed |
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.
reversed -->backward.
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
def bi_lstm_encoder(input_seq, hidden_size): | ||
input_forward_proj = fluid.layers.fc(input=input_seq, | ||
size=hidden_size * 4, | ||
act='tanh', |
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.
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.
已去掉'tanh'
use_peepholes=USE_PEEPHOLES) | ||
input_reversed_proj = fluid.layers.fc(input=input_seq, | ||
size=hidden_size * 4, | ||
act='tanh', |
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.
同上,为什么要使用“tanh”激活?
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.
已去掉'tanh'
|
||
|
||
def lstm_step(x_t, hidden_t_prev, cell_t_prev, size): | ||
def linear(inputs): |
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.
加一个 fixme 的comment, replace this function with the lstm_unit_op.
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
encoded_vector = fluid.layers.concat( | ||
input=[src_forward, src_reversed], axis=1) | ||
|
||
context = fluid.layers.sequence_pool(input=encoded_vector, pool_type='last') |
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.
请确认一下现在op的逻辑,reverse的时候是否要取first 而不是last。
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.
已确认,reverse时也是取last。
958bf0e
to
d6e06d3
Compare
d6e06d3
to
beb9075
Compare
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.
LGTM
resolve #7012