diff --git a/python/paddle/fluid/optimizer.py b/python/paddle/fluid/optimizer.py index 2e596ef118e0b2cc4696043759dc33f560df79f9..6f9cc197ee447e80ff65286a426ac7cb58ac3727 100644 --- a/python/paddle/fluid/optimizer.py +++ b/python/paddle/fluid/optimizer.py @@ -55,7 +55,7 @@ class Optimizer(object): """ def __init__(self, learning_rate, regularization=None, name=None): - if framework._in_imperative_mode(): + if framework._in_dygraph_mode(): if not isinstance(learning_rate, float) and \ not isinstance(learning_rate, LearningRateDecay): raise TypeError(