diff --git a/python/paddle/fluid/layers/tensor.py b/python/paddle/fluid/layers/tensor.py index b62df9c102485ae056fb0fbc85b6d7391a98c88c..8affa851b008f852405436c4287f063f833b69fa 100644 --- a/python/paddle/fluid/layers/tensor.py +++ b/python/paddle/fluid/layers/tensor.py @@ -634,6 +634,8 @@ def assign(input, output=None): if _non_static_mode(): if in_dygraph_mode() and output is None: output = _C_ops.assign(input) + elif in_dygraph_mode() and output is not None: + _C_ops.assign_out_(input, output) else: if output is None: if _in_legacy_dygraph():