| 419 | } |
| 420 | |
| 421 | void DedupControlInputs(NodeDef* node) { |
| 422 | std::unordered_set<string> inputs; |
| 423 | int pos = 0; |
| 424 | while (pos < node->input_size()) { |
| 425 | const string& input = node->input(pos); |
| 426 | if (!inputs.insert(NodeName(input)).second && IsControlInput(input)) { |
| 427 | node->mutable_input()->SwapElements(pos, node->input_size() - 1); |
| 428 | node->mutable_input()->RemoveLast(); |
| 429 | } else { |
| 430 | ++pos; |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | namespace { |
| 436 |