Skip to content

Commit d8ee77c

Browse files
committed
[API-Compat] Fixed sort out
1 parent 7731d1c commit d8ee77c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/paddle/tensor/compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ def sort(
317317
"""
318318
_check_out_status(out, expect_multiple=True)
319319
outputs, indices = _C_ops.argsort(input, dim, descending, stable)
320-
if out is None:
321-
return SortRetType(values=outputs, indices=indices)
322-
paddle.assign(outputs, out[0])
323-
paddle.assign(indices, out[1])
320+
if out is not None:
321+
paddle.assign(outputs, out[0])
322+
paddle.assign(indices, out[1])
323+
return SortRetType(values=outputs, indices=indices)
324324

325325

326326
class Unfold(nn.Unfold):

0 commit comments

Comments
 (0)