未验证 提交 7e05680c 编写于 作者: C crystal 提交者: GitHub

Move the redundant numpy() (#40931)

上级 0ee76f92
...@@ -2432,7 +2432,7 @@ def cond(pred, true_fn=None, false_fn=None, name=None): ...@@ -2432,7 +2432,7 @@ def cond(pred, true_fn=None, false_fn=None, name=None):
""" """
if _non_static_mode(): if _non_static_mode():
assert isinstance(pred, Variable), "The pred in cond must be Variable" 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] pred = pred.numpy()[0]
if pred: if pred:
if true_fn is not None: if true_fn is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册