diff options
Diffstat (limited to 'reference_model/src/verify/verify_utils.cc')
-rw-r--r-- | reference_model/src/verify/verify_utils.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/reference_model/src/verify/verify_utils.cc b/reference_model/src/verify/verify_utils.cc index 3bdc99f..5ce646c 100644 --- a/reference_model/src/verify/verify_utils.cc +++ b/reference_model/src/verify/verify_utils.cc @@ -1,5 +1,5 @@ -// Copyright (c) 2023, ARM Limited. +// Copyright (c) 2023-2024, ARM Limited. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(VerifyMode, { VerifyMode::AbsError, "ABS_ERROR" }, }) -void from_json(const nlohmann::json& j, UlpInfo& ulpInfo) +void from_json(const nlohmann::json& j, UlpVerifyInfo& ulpInfo) { j.at("ulp").get_to(ulpInfo.ulp); } @@ -70,6 +70,14 @@ void from_json(const nlohmann::json& j, ReduceProductVerifyInfo& reduceProduceIn j.at("n").get_to(reduceProduceInfo.n); } +void from_json(const nlohmann::json& j, AbsErrorVerifyInfo& absErrorInfo) +{ + if (j.contains("lower_bound")) + { + j.at("lower_bound").get_to(absErrorInfo.lowerBound); + } +} + void from_json(const nlohmann::json& j, VerifyConfig& cfg) { j.at("mode").get_to(cfg.mode); @@ -86,6 +94,12 @@ void from_json(const nlohmann::json& j, VerifyConfig& cfg) { j.at("reduce_product_info").get_to(cfg.reduceProductInfo); } + // Set up defaults for optional AbsErrorVerifyInfo + cfg.absErrorInfo.lowerBound = 0; + if (j.contains("abs_error_info")) + { + j.at("abs_error_info").get_to(cfg.absErrorInfo); + } } std::optional<VerifyConfig> parseVerifyConfig(const char* tensorName, const char* json) |