Compatibility patch for nlohmann/json < 3.9.0. (#12394)

This is required on CentOS 7 if using distro-provided json-devel 3.6.1.

Regression introduced in:
- https://github.com/microsoft/onnxruntime/pull/11775

Related upstream commit:
-
74520d8bb0

Fixed https://github.com/microsoft/onnxruntime/issues/12393
This commit is contained in:
xkszltl 2023-01-17 08:59:20 +08:00 committed by GitHub
parent 7f374f4012
commit 3a9f30df46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,7 +75,12 @@ static TestTolerances LoadTestTolerances(bool enable_cuda, bool enable_openvino)
}
const auto overrides_json = nlohmann::json::parse(
overrides_ifstream,
/*cb=*/nullptr, /*allow_exceptions=*/true, /*ignore_comments=*/true);
/*cb=*/nullptr, /*allow_exceptions=*/true
// Comment support is added in 3.9.0 with breaking change to default behavior.
#if NLOHMANN_JSON_VERSION_MAJOR * 1000 + NLOHMANN_JSON_VERSION_MINOR >= 3009
, /*ignore_comments=*/true
#endif
);
overrides_json["atol_overrides"].get_to(absolute_overrides);
overrides_json["rtol_overrides"].get_to(relative_overrides);
return TestTolerances(