diff --git a/fluid/PaddleRec/word2vec/net.py b/fluid/PaddleRec/word2vec/net.py index 1945b62a44925154583aadca173883359378a02a..f283b1cf36a2d6fd25947082853e16e9aa749e7d 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