From 70f7c23fd27703092c88d752060ad201258bc506 Mon Sep 17 00:00:00 2001 From: xujiaqi01 <173596896@qq.com> Date: Sat, 11 Apr 2020 18:38:58 +0800 Subject: [PATCH] fix add dense table (#23681) * fix add dense table test=develop * fix test=develop * fix test=develop --- .../fleet/parameter_server/pslib/optimizer_factory.py | 8 ++++---- python/paddle/fluid/tests/unittests/test_fleet.py | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python/paddle/fluid/incubate/fleet/parameter_server/pslib/optimizer_factory.py b/python/paddle/fluid/incubate/fleet/parameter_server/pslib/optimizer_factory.py index 11d56e8491..d7437f9c47 100644 --- a/python/paddle/fluid/incubate/fleet/parameter_server/pslib/optimizer_factory.py +++ b/python/paddle/fluid/incubate/fleet/parameter_server/pslib/optimizer_factory.py @@ -470,10 +470,10 @@ class DistributedAdam(DistributedOptimizerImplBase): strategy.get("scale_datanorm", -1) }) - program_configs[program_id]["pull_dense"].extend( - [dense_table_index]) - program_configs[program_id]["push_dense"].extend( - [dense_table_index]) + program_configs[program_id]["pull_dense"].extend( + [dense_table_index]) + program_configs[program_id]["push_dense"].extend( + [dense_table_index]) dense_table_index += 1 # Todo(guru4elephant): figure out how to support more sparse parameters diff --git a/python/paddle/fluid/tests/unittests/test_fleet.py b/python/paddle/fluid/tests/unittests/test_fleet.py index 6657f5a120..ca232dd2ff 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet.py +++ b/python/paddle/fluid/tests/unittests/test_fleet.py @@ -62,7 +62,9 @@ class TestFleet1(unittest.TestCase): emb = fluid.layers.embedding(input=show, size=[1, 1], \ is_sparse=True, is_distributed=True, \ param_attr=fluid.ParamAttr(name="embedding")) - fc = fluid.layers.fc(input=emb, size=1, act=None) + bow = fluid.layers.sequence_pool(input=emb, pool_type='sum') + bow = fluid.layers.data_norm(input=bow, epsilon=1e-4, name="norm") + fc = fluid.layers.fc(input=bow, size=1, act=None) label = fluid.layers.data(name="click", shape=[-1, 1], \ dtype="int64", lod_level=1, append_batch_size=False) label_cast = fluid.layers.cast(label, dtype='float32') -- GitLab