diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index f4f462ec3bbae03a8f5e87e3083a0ee26a51a72b..7757226898144e33a6a18467eead2b91ed9256a9 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -6540,7 +6540,8 @@ for func in [ def _logical_op(op_name, x, y, out=None, name=None, binary_op=True): helper = LayerHelper(op_name, **locals()) - assert x.dtype == y.dtype + if binary_op: + assert x.dtype == y.dtype if out is None: if name is None: