From db82b9e227e0e37e05a2267eb42bbf2271360151 Mon Sep 17 00:00:00 2001 From: Jiabin Yang <360788950@qq.com> Date: Tue, 7 Mar 2023 11:46:31 +0800 Subject: [PATCH] support erf fp64 error (#51241) --- paddle/fluid/prim/api/manual_prim/static_prim_api.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/prim/api/manual_prim/static_prim_api.cc b/paddle/fluid/prim/api/manual_prim/static_prim_api.cc index 01e0f4a10eb..54f419e4a9f 100644 --- a/paddle/fluid/prim/api/manual_prim/static_prim_api.cc +++ b/paddle/fluid/prim/api/manual_prim/static_prim_api.cc @@ -76,9 +76,12 @@ Tensor full(const IntArray& shape, case phi::DataType::FLOAT32: op->SetAttr("value", value.to()); break; - case phi::DataType::FLOAT64: - op->SetAttr("str_value", std::to_string(value.to())); + case phi::DataType::FLOAT64: { + std::stringstream ss; + ss << std::setprecision(20) << value.to(); + op->SetAttr("str_value", ss.str()); break; + } case phi::DataType::BOOL: op->SetAttr("str_value", std::to_string(value.to())); break; -- GitLab