未验证 提交 4898665c 编写于 作者: R Ruibin Cheung 提交者: GitHub

fix: support str_value of Scalar is bool (#56068)

上级 597f6d43
...@@ -110,6 +110,12 @@ class ScalarBase { ...@@ -110,6 +110,12 @@ class ScalarBase {
data_.f64 = -std::numeric_limits<double>::infinity(); data_.f64 = -std::numeric_limits<double>::infinity();
} else if (str_value == "nan") { } else if (str_value == "nan") {
data_.f64 = std::numeric_limits<double>::quiet_NaN(); data_.f64 = std::numeric_limits<double>::quiet_NaN();
} else if (str_value == "True") {
dtype_ = DataType::BOOL;
data_.b = true;
} else if (str_value == "Fasle") {
dtype_ = DataType::BOOL;
data_.b = false;
} else { } else {
// NOTE(chenfeiyu): to support subnormal floating point number // NOTE(chenfeiyu): to support subnormal floating point number
// std::stod cannot handle subnormal values // std::stod cannot handle subnormal values
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册