| 436 | |
| 437 | template <typename UniqueContainer> |
| 438 | void EraseNodesFromGraphImpl(const UniqueContainer& nodes_to_delete, |
| 439 | GraphDef* graph) { |
| 440 | static_assert(std::is_same<typename UniqueContainer::value_type, int>::value, |
| 441 | "Need to pass container of ints"); |
| 442 | |
| 443 | int last = graph->node_size() - 1; |
| 444 | for (auto it = nodes_to_delete.rbegin(); it != nodes_to_delete.rend(); ++it) { |
| 445 | const int index = *it; |
| 446 | graph->mutable_node()->SwapElements(index, last); |
| 447 | last--; |
| 448 | } |
| 449 | graph->mutable_node()->DeleteSubrange(last + 1, nodes_to_delete.size()); |
| 450 | } |
| 451 | |
| 452 | template <typename T> |
| 453 | inline void STLSortAndRemoveDuplicates(T* v) { |
no test coverage detected