MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ScanArrayNames

Function ScanArrayNames

tensorflow/lite/toco/tooling_util.cc:2331–2347  ·  view source on GitHub ↗

Returns the array names that match the ArraysExtraInfo's name and name_regexp. The regexp match is for a full match.

Source from the content-addressed store, hash-verified

2329// Returns the array names that match the ArraysExtraInfo's name and
2330// name_regexp. The regexp match is for a full match.
2331std::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
2349void UseArraysExtraInfo(Model* model, bool quantize_output) {
2350 for (const auto& entry : model->flags.arrays_extra_info().entries()) {

Callers 1

UseArraysExtraInfoFunction · 0.85

Calls 6

HasArrayMethod · 0.80
nameMethod · 0.65
insertMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected