You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2025/07/04 21:46:32 UTC

(tvm) branch main updated: [Fix][Serialization] Add support for NaN value serialization (#18115)

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 937857549e [Fix][Serialization] Add support for NaN value serialization (#18115)
937857549e is described below

commit 937857549e806cdeb2ebe87e49bff35e8041343e
Author: quyp-intellif <qu...@163.com>
AuthorDate: Sat Jul 5 05:46:27 2025 +0800

    [Fix][Serialization] Add support for NaN value serialization (#18115)
    
    [Fix][Serialization] Handle NaN deserialization for double
---
 src/node/serialization.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/node/serialization.cc b/src/node/serialization.cc
index 60b455589f..30eed9d817 100644
--- a/src/node/serialization.cc
+++ b/src/node/serialization.cc
@@ -457,6 +457,8 @@ class JSONAttrSetter {
       *value = std::numeric_limits<double>::infinity();
     } else if (is.str() == "-inf") {
       *value = -std::numeric_limits<double>::infinity();
+    } else if (is.str() == "nan") {
+      *value = std::numeric_limits<double>::quiet_NaN();
     } else {
       is >> *value;
       if (is.fail()) {