| 700 | const std::filesystem::path & index_path) { |
| 701 | const auto root = engine::io::json::parse_file(index_path); |
| 702 | const auto & object = root.require("weight_map").as_object(); |
| 703 | std::unordered_map<std::string, std::string> weight_map; |
| 704 | weight_map.reserve(object.size()); |
| 705 | for (const auto & [name, value] : object) { |
| 706 | weight_map.emplace(name, value.as_string()); |
| 707 | } |
| 708 | if (weight_map.empty()) { |
| 709 | throw std::runtime_error("indexed tensor source has an empty weight_map: " + index_path.string()); |
| 710 | } |
no outgoing calls