Returns the array names that match the ArraysExtraInfo's name and name_regexp. The regexp match is for a full match.
| 2329 | // Returns the array names that match the ArraysExtraInfo's name and |
| 2330 | // name_regexp. The regexp match is for a full match. |
| 2331 | std::unordered_set<string> ScanArrayNames( |
| 2332 | const Model& model, const toco::ArraysExtraInfo_Entry& entry) { |
| 2333 | std::unordered_set<string> matches; |
| 2334 | if (model.HasArray(entry.name())) { |
| 2335 | matches.insert(entry.name()); |
| 2336 | } |
| 2337 | if (!entry.name_regexp().empty()) { |
| 2338 | const auto& arrays = model.GetArrayMap(); |
| 2339 | const RE2 name_regexp = {entry.name_regexp()}; |
| 2340 | for (auto it = arrays.begin(); it != arrays.end(); ++it) { |
| 2341 | if (RE2::FullMatch(it->first, name_regexp)) { |
| 2342 | matches.insert(it->first); |
| 2343 | } |
| 2344 | } |
| 2345 | } |
| 2346 | return matches; |
| 2347 | } |
| 2348 | |
| 2349 | void UseArraysExtraInfo(Model* model, bool quantize_output) { |
| 2350 | for (const auto& entry : model->flags.arrays_extra_info().entries()) { |