diff --git a/python/paddle/fluid/layers/control_flow.py b/python/paddle/fluid/layers/control_flow.py index d6d3b31686ebe10777e9003c3a096a0e0d6acafc..0c71c9089a0b6fb8973bdd27d479bbd056cc5bcf 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: