MasterJH5574 opened a new pull request, #14118:
URL: https://github.com/apache/tvm/pull/14118

   In MetaSchedule, when dumping a FloatImm as JSON, at this moment we are using
   ```c++
   os << std::setprecision(20) << float_imm->value;
   ```
   
   In this way, float values that are "integers" (e.g., `1.0`, `2.0`) will be 
dumped as strings without decimal. For example, `1.0` will be dumped as `1`, 
and `2.0` will be dumped as `2`.
   
   This lead to error when we parse back the JSON string, as the parser will 
treat `1` as an IntImm insted of FloatImm.
   
   Therefore, this PR aims to ensure that FloatImms are printed with at least 
one decimal when dumping. We achieve this with the help of `std::modf` in C++ 
math, which extracts the integral part and fractional part from a double/float 
value. When the fractional part is `0.0`, we use `std::fixed` to enforce one 
decimal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to