From cb4b27de4d7b9f38fe118b06291e5971f2cb4432 Mon Sep 17 00:00:00 2001 From: zhangwenhui03 Date: Mon, 25 Mar 2019 18:56:59 +0800 Subject: [PATCH] fix bug --- fluid/PaddleRec/word2vec/net.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fluid/PaddleRec/word2vec/net.py b/fluid/PaddleRec/word2vec/net.py index 1945b62a..f283b1cf 100644 --- a/fluid/PaddleRec/word2vec/net.py +++ b/fluid/PaddleRec/word2vec/net.py @@ -101,11 +101,8 @@ def skip_gram_word2vec(dict_size, embedding_size, is_sparse=False, neg_num=5): label_ones) neg_xent = fluid.layers.sigmoid_cross_entropy_with_logits(neg_logits, label_zeros) - cost = fluid.layers.elementwise_add( - fluid.layers.reduce_sum( - true_xent, dim=1), - fluid.layers.reduce_sum( + true_xent, fluid.layers.reduce_sum( neg_xent, dim=1)) avg_cost = fluid.layers.reduce_mean(cost) return avg_cost, py_reader -- GitLab