aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/graph/graph_constructor.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-06-01 09:42:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-01 09:45:21 -0700
commiteb10a4c494d95e7c17ddc44ef35197d08f2f6b33 (patch)
treec920e61142ba74b437c3c39036a4748ba575b039 /tensorflow/core/graph/graph_constructor.cc
parentce32228c49e595f966485acee947131e4ab04905 (diff)
Preallocate vector storage when the ultimate vector size is known in advance
PiperOrigin-RevId: 157724431
Diffstat (limited to 'tensorflow/core/graph/graph_constructor.cc')
-rw-r--r--tensorflow/core/graph/graph_constructor.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/core/graph/graph_constructor.cc b/tensorflow/core/graph/graph_constructor.cc
index 1d7eea2206..19442d8c08 100644
--- a/tensorflow/core/graph/graph_constructor.cc
+++ b/tensorflow/core/graph/graph_constructor.cc
@@ -496,6 +496,7 @@ Status GraphConstructor::ModifyNodeDefForImport(NodeDef* node_def) {
void RemoveInputs(NodeDef* node_def, const std::vector<int>& inputs_to_remove) {
// TODO(skyewm): is there a better way to do this?
std::vector<string> inputs;
+ inputs.reserve(node_def->input_size());
for (int i = 0; i < node_def->input_size(); ++i) {
inputs.push_back(node_def->input(i));
}