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

Function CheckOperatorOrdering

tensorflow/lite/toco/tooling_util.cc:1082–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1080}
1081
1082void CheckOperatorOrdering(const Model& model) {
1083 std::unordered_set<string> arrays_behind_us;
1084 for (const auto& array_entry : model.GetArrayMap()) {
1085 if (!GetOpWithOutput(model, array_entry.first)) {
1086 arrays_behind_us.insert(array_entry.first);
1087 }
1088 }
1089 arrays_behind_us.insert(model.optional_arrays.begin(),
1090 model.optional_arrays.end());
1091 for (const auto& op : model.operators) {
1092 for (const auto& input : op->inputs) {
1093 if (!IsConstantParameterArray(model, input)) {
1094 CHECK(arrays_behind_us.count(input));
1095 }
1096 }
1097 for (const auto& output : op->outputs) {
1098 CHECK(!arrays_behind_us.count(output));
1099 arrays_behind_us.insert(output);
1100 }
1101 }
1102 for (const string& output_array : model.flags.output_arrays()) {
1103 CHECK(arrays_behind_us.count(output_array));
1104 }
1105}
1106
1107void FixOperatorOrdering(Model* model) {
1108 std::unordered_set<string> arrays_behind_us;

Callers 1

CheckInvariantsFunction · 0.85

Calls 6

GetOpWithOutputFunction · 0.85
IsConstantParameterArrayFunction · 0.85
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected