| 140 | } |
| 141 | |
| 142 | int CountOpsWithInput(const Model& model, const string& array_name) { |
| 143 | int count = 0; |
| 144 | for (const auto& op : model.operators) { |
| 145 | for (auto& input : op->inputs) { |
| 146 | if (input == array_name) { |
| 147 | count++; |
| 148 | // Breaking here is important: some graphs have ops that use the |
| 149 | // same array as more than one of their inputs, and in that case |
| 150 | // we want it counted only once. |
| 151 | break; |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | return count; |
| 156 | } |
| 157 | |
| 158 | bool DeleteArrayIfUnused(const string& array_name, Model* model) { |
| 159 | if (IsDiscardableArray(*model, array_name) && |
no outgoing calls
no test coverage detected