From 7e05680c9269f552138c0beb03a71164b14064c0 Mon Sep 17 00:00:00 2001 From: crystal <62974595+Zjq9409@users.noreply.github.com> Date: Sat, 26 Mar 2022 12:12:42 +0800 Subject: [PATCH] Move the redundant numpy() (#40931) --- python/paddle/fluid/layers/control_flow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/layers/control_flow.py b/python/paddle/fluid/layers/control_flow.py index d6d3b31686..0c71c9089a 100755 --- a/python/paddle/fluid/layers/control_flow.py +++ b/python/paddle/fluid/layers/control_flow.py @@ -2432,7 +2432,7 @@ def cond(pred, true_fn=None, false_fn=None, name=None): """ if _non_static_mode(): assert isinstance(pred, Variable), "The pred in cond must be Variable" - assert pred.numpy().size == 1, "condition input's numel should be 1" + assert pred.size == 1, "condition input's numel should be 1" pred = pred.numpy()[0] if pred: if true_fn is not None: -- GitLab