Skip to content

Commit

Permalink
add act to fc
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesqiao committed Dec 8, 2017
1 parent 8263bfb commit daacff6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/paddle/v2/fluid/tests/book/test_machine_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def encoder_decoder():
is_sparse=IS_SPARSE,
param_attr=fluid.ParamAttr(name='vemb'))

fc1 = fluid.layers.fc(input=src_embedding, size=hidden_dim * 4)
fc1 = fluid.layers.fc(input=src_embedding, size=hidden_dim * 4, act='tanh')
lstm_hidden0, lstm_0 = layers.dynamic_lstm(input=fc1, size=hidden_dim * 4)
encoder_out = layers.sequence_pool(input=lstm_hidden0, pool_type="last")

Expand All @@ -49,7 +49,9 @@ def encoder_decoder():
with rnn.block():
current_word = rnn.step_input(trg_embedding)
mem = rnn.memory(init=encoder_out)
fc1 = fluid.layers.fc(input=[current_word, mem], size=decoder_size)
fc1 = fluid.layers.fc(input=[current_word, mem],
size=decoder_size,
act='tanh')
out = fluid.layers.fc(input=fc1, size=target_dict_dim, act='softmax')
rnn.update_memory(mem, fc1)
rnn.output(out)
Expand Down

0 comments on commit daacff6

Please sign in to comment.