From e8f65b86f5d363d595d43d9205a34cc7f8095c15 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Wed, 12 Apr 2017 17:49:16 +0800 Subject: [PATCH] nce_layer cannot accept neg_distribution --- python/paddle/trainer_config_helpers/layers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index aae419566..a89b7eb0c 100755 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -4873,7 +4873,7 @@ def nce_layer(input, if neg_distribution is not None: assert isinstance(neg_distribution, collections.Sequence) assert len(neg_distribution) == num_classes - assert sum(neg_distribution) == 1 + assert abs(sum(neg_distribution) - 1.0) < 1e-5 if not isinstance(act, BaseActivation): raise TypeError() -- GitLab