From 15eea58c23e83143b4643517c53b6e8fd4c113d2 Mon Sep 17 00:00:00 2001 From: chengduoZH Date: Fri, 28 Sep 2018 15:38:12 +0800 Subject: [PATCH] update transformer --- fluid/neural_machine_translation/transformer/model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fluid/neural_machine_translation/transformer/model.py b/fluid/neural_machine_translation/transformer/model.py index ee2d1d50..4468f479 100644 --- a/fluid/neural_machine_translation/transformer/model.py +++ b/fluid/neural_machine_translation/transformer/model.py @@ -219,6 +219,7 @@ def prepare_encoder_decoder(src_word, size=[src_max_len, src_emb_dim], param_attr=fluid.ParamAttr( name=pos_enc_param_name, trainable=False)) + src_pos_enc.stop_gradient = True enc_input = src_word_emb + src_pos_enc return layers.dropout( enc_input, -- GitLab