Skip to content

Commit c6ebcc7

Browse files
committed
add decayed_adagrad support for dist train
1 parent 4aed00e commit c6ebcc7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

python/paddle/fluid/tests/unittests/test_dist_transpiler.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,25 @@ def transpiler_test_impl(self):
264264
])
265265

266266

267+
class TestDecayedAdagrad(TranspilerTest):
268+
def net_conf(self):
269+
x = fluid.layers.data(name='x', shape=[1000], dtype='float32')
270+
y_predict = fluid.layers.fc(input=x,
271+
size=1000,
272+
act=None,
273+
param_attr=fluid.ParamAttr(name='fc_w'),
274+
bias_attr=fluid.ParamAttr(name='fc_b'))
275+
y = fluid.layers.data(name='y', shape=[1], dtype='float32')
276+
cost = fluid.layers.square_error_cost(input=y_predict, label=y)
277+
avg_cost = fluid.layers.mean(cost)
278+
opt = fluid.optimizer.DecayedAdagrad(learning_rate=0.1)
279+
opt.minimize(avg_cost)
280+
281+
def transpiler_test_impl(self):
282+
pserver, startup = self.get_pserver(self.pserver1_ep)
283+
trainer, _ = self.get_trainer()
284+
285+
267286
class TestLRDecayConditional(TranspilerTest):
268287
def net_conf(self):
269288
x = fluid.layers.data(name='x', shape=[1000], dtype='float32')

python/paddle/fluid/transpiler/distribute_transpiler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,9 @@ def _get_optimizer_input_shape(self, op_type, varkey, orig_shape,
14301430
elif op_type == "rmsprop":
14311431
if varkey in ["Moment", "MeanSquare"]:
14321432
return param_shape
1433+
elif op_type == "decayed_adagrad":
1434+
if varkey == "Moment":
1435+
return param_shape
14331436
elif op_type == "sgd":
14341437
pass
14351438
return orig_shape

0 commit comments

Comments
 (0)