mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-06 04:28:32 +00:00
fix float16 comparison in initializer (#2629)
This commit is contained in:
parent
c04647b952
commit
d6f33dceb1
1 changed files with 1 additions and 1 deletions
|
|
@ -63,7 +63,7 @@ bool IsInitializerWithExpectedValue(const Graph& graph, const NodeArg& input_arg
|
|||
}
|
||||
} else if (data_type == ONNX_NAMESPACE::TensorProto_DataType_FLOAT16) {
|
||||
const MLFloat16* val = init_const->data<MLFloat16>();
|
||||
float diff = std::abs(math::halfToFloat(val[0].val) - static_cast<float>(expected_value));
|
||||
float diff = std::abs(math::halfToFloat(val[0].val) - math::halfToFloat(math::floatToHalf(expected_value)));
|
||||
if (diff > FLT_EPSILON) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue