Use DeleteSubrange when deleting nodes from the graph in the new GraphView.

PiperOrigin-RevId: 269403726
This commit is contained in:
A. Unique TensorFlower 2019-09-16 13:12:01 -07:00 committed by TensorFlower Gardener
parent 68f0fec1fd
commit 98b54f7d93

View File

@ -1362,7 +1362,12 @@ void MutableGraphView::RemoveNodesInternal(
removed_node_index;
}
nodes_.pop_back();
graph()->mutable_node()->RemoveLast();
}
if (!sorted_node_indices_to_remove.empty()) {
const int current_size = graph()->node_size();
const int num_to_remove = sorted_node_indices_to_remove.size();
graph()->mutable_node()->DeleteSubrange(current_size - num_to_remove,
num_to_remove);
}
}