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

Function DeleteArrayIfUnusedOutsideOfOp

tensorflow/lite/toco/tooling_util.cc:168–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168bool DeleteArrayIfUnusedOutsideOfOp(const string& array_name,
169 const Operator* op, Model* model) {
170 if (!IsDiscardableArray(*model, array_name)) {
171 return false;
172 }
173 if (CountOpsWithInput(*model, array_name) > 1) {
174 return false;
175 }
176 const Operator* op_having_this_as_input = GetOpWithInput(*model, array_name);
177 if (op_having_this_as_input && op_having_this_as_input != op) {
178 return false;
179 }
180 const Operator* op_having_this_as_output =
181 GetOpWithOutput(*model, array_name);
182 if (op_having_this_as_output && op_having_this_as_output != op) {
183 return false;
184 }
185 model->EraseArray(array_name);
186 return true;
187}
188
189void DeleteOpAndArrays(Model* model, const Operator* op) {
190 for (const string& array_name : op->inputs) {

Callers 6

DeleteOpAndArraysFunction · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85

Calls 5

IsDiscardableArrayFunction · 0.85
CountOpsWithInputFunction · 0.85
GetOpWithInputFunction · 0.85
GetOpWithOutputFunction · 0.85
EraseArrayMethod · 0.80

Tested by

no test coverage detected