Skip to content

Commit e24b5dd

Browse files
committed
Fix
1 parent a0941c7 commit e24b5dd

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

python/paddle/incubate/optimizer/lars_momentum.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,22 @@ def _append_optimize_op(self, block, param_and_grad):
189189
inputs["MasterParam"] = master_weight
190190
outputs["MasterParamOut"] = master_weight
191191

192-
if in_dynamic_mode() or in_pir_mode():
192+
if in_dynamic_mode():
193+
_, _, _ = _C_ops.lars_momentum_(
194+
[param_and_grad[0]],
195+
[param_and_grad[1]],
196+
[velocity_acc],
197+
[lr],
198+
master_weight,
199+
self._momentum,
200+
self._lars_coeff,
201+
[_lars_weight_decay],
202+
self._epsilon,
203+
find_master,
204+
self._rescale_grad,
205+
)
206+
return None
207+
elif in_pir_mode():
193208
if isinstance(master_weight, pir.Value):
194209
master_weight = [master_weight]
195210
_, _, _ = _C_ops.lars_momentum_(

0 commit comments

Comments
 (0)