diff --git a/python/paddle/tensor/logic.py b/python/paddle/tensor/logic.py index 3eb142f13cfd89ef0ad7ad77627e7616cf533214..e8b699b1f085f08d7ceca3475b0f9b4436862aac 100755 --- a/python/paddle/tensor/logic.py +++ b/python/paddle/tensor/logic.py @@ -393,12 +393,7 @@ def allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name=None): """ if in_dygraph_mode(): - # NOTE(dev): Pass tol as Tensor to fix precision loss problem, because - # C++ backend will cast it into float32 if passing float from python. - as_tensor = lambda x: paddle.to_tensor( - [x], dtype='float64', place='cpu') - return _C_ops.allclose(x, y, as_tensor(rtol), as_tensor(atol), - equal_nan) + return _C_ops.allclose(x, y, rtol, atol, equal_nan) if _in_legacy_dygraph(): return _legacy_C_ops.allclose(x, y, 'rtol', str(rtol), 'atol', str(atol), 'equal_nan', equal_nan) @@ -998,11 +993,7 @@ def isclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name=None): """ if in_dygraph_mode(): - # NOTE(dev): Pass tol as Tensor to fix precision loss problem, because - # C++ backend will cast it into float32 if passing float from python. - as_tensor = lambda x: paddle.to_tensor( - [x], dtype='float64', place='cpu') - return _C_ops.isclose(x, y, as_tensor(rtol), as_tensor(atol), equal_nan) + return _C_ops.isclose(x, y, rtol, atol, equal_nan) if _in_legacy_dygraph(): return _legacy_C_ops.isclose(x, y, 'rtol', str(rtol), 'atol', str(atol), 'equal_nan', equal_nan)