From 17df5ddf02bfbbe5a9eaf674d11cbc54539dbdf3 Mon Sep 17 00:00:00 2001 From: Weilong Wu Date: Wed, 13 Apr 2022 17:12:46 +0800 Subject: [PATCH] [Eager] Fix test_imperative_optimizer_v2 eager mode global issue (#41633) (#41727) --- python/paddle/optimizer/lr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/paddle/optimizer/lr.py b/python/paddle/optimizer/lr.py index 528fab1c2b9..d0d5eef03c4 100644 --- a/python/paddle/optimizer/lr.py +++ b/python/paddle/optimizer/lr.py @@ -1360,6 +1360,8 @@ class ReduceOnPlateau(LRScheduler): if not _in_legacy_dygraph(): tmp = core.eager.Tensor else: + # need to declarate explicitly + from paddle.framework import VarBase as Tensor tmp = Tensor # loss must be float, numpy.ndarray or 1-D Tensor with shape [1] if isinstance(metrics, (tmp, numpy.ndarray)): -- GitLab