diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-06-01 09:42:04 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-06-01 09:45:21 -0700 |
commit | eb10a4c494d95e7c17ddc44ef35197d08f2f6b33 (patch) | |
tree | c920e61142ba74b437c3c39036a4748ba575b039 /tensorflow/cc/client | |
parent | ce32228c49e595f966485acee947131e4ab04905 (diff) |
Preallocate vector storage when the ultimate vector size is known in advance
PiperOrigin-RevId: 157724431
Diffstat (limited to 'tensorflow/cc/client')
-rw-r--r-- | tensorflow/cc/client/client_session.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tensorflow/cc/client/client_session.cc b/tensorflow/cc/client/client_session.cc index 2879445441..ba056a8f3a 100644 --- a/tensorflow/cc/client/client_session.cc +++ b/tensorflow/cc/client/client_session.cc @@ -113,10 +113,12 @@ Status ClientSession::Run(const RunOptions& run_options, const FeedType& inputs, feeds.emplace_back(feed.first.name(), feed.second.tensor); } std::vector<string> output_tensor_names; + output_tensor_names.reserve(fetch_outputs.size()); for (auto const& output : fetch_outputs) { output_tensor_names.push_back(output.name()); } std::vector<string> target_node_names; + target_node_names.reserve(run_outputs.size()); for (auto const& output : run_outputs) { target_node_names.push_back(output.node()->name()); } |