Skip to content

Conversation

@micricket
Copy link
Contributor

@micricket micricket commented Jul 4, 2025

Description

Currently, the JSONAttrSetter::ParseDouble function in src/node/serialization.cc correctly handles infinity ("inf", "-inf") but does not have a case for Not-a-Number ("nan"). This can cause errors when serializing TVM objects that contain NaN float values.

This change adds a condition to explicitly check for the string "nan" and correctly parse it into std::numeric_limits<double>::quiet_NaN(). This aligns the NaN handling with the existing logic for infinity values, making the serialization more robust.

@micricket micricket changed the title [Fix][Serialization] Add support for NaN value deserialization [Fix][Serialization] Add support for NaN value serialization Jul 4, 2025
@tqchen tqchen merged commit 9378575 into apache:main Jul 4, 2025
12 checks passed
ShiboXing pushed a commit to ShiboXing/tvm that referenced this pull request Aug 10, 2025
…18115)

[Fix][Serialization] Handle NaN deserialization for double
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants