未验证 提交 1dc445f5 编写于 作者: C Cao Ying 提交者: GitHub

Merge pull request #435 from lcy-seso/fix_nce

fix a bug of NCE prediction.
...@@ -33,7 +33,6 @@ def ngram_lm(hidden_size, emb_size, dict_size, gram_num=4, is_train=True): ...@@ -33,7 +33,6 @@ def ngram_lm(hidden_size, emb_size, dict_size, gram_num=4, is_train=True):
num_classes=dict_size, num_classes=dict_size,
param_attr=paddle.attr.Param(name="nce_w"), param_attr=paddle.attr.Param(name="nce_w"),
bias_attr=paddle.attr.Param(name="nce_b"), bias_attr=paddle.attr.Param(name="nce_b"),
act=paddle.activation.Sigmoid(),
num_neg_samples=25, num_neg_samples=25,
neg_distribution=None) neg_distribution=None)
else: else:
...@@ -41,7 +40,7 @@ def ngram_lm(hidden_size, emb_size, dict_size, gram_num=4, is_train=True): ...@@ -41,7 +40,7 @@ def ngram_lm(hidden_size, emb_size, dict_size, gram_num=4, is_train=True):
size=dict_size, size=dict_size,
input=paddle.layer.trans_full_matrix_projection( input=paddle.layer.trans_full_matrix_projection(
hidden_layer, param_attr=paddle.attr.Param(name="nce_w")), hidden_layer, param_attr=paddle.attr.Param(name="nce_w")),
act=paddle.activation.Sigmoid(), act=paddle.activation.Softmax(),
bias_attr=paddle.attr.Param(name="nce_b")) bias_attr=paddle.attr.Param(name="nce_b"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册