Pre-allocate memory for vectors where size is already known.

PiperOrigin-RevId: 354117982
Change-Id: I868507ccb54c700973dc2c923fc2dda9b3d5bfac
This commit is contained in:
A. Unique TensorFlower 2021-01-27 10:17:28 -08:00 committed by TensorFlower Gardener
parent c1837809c1
commit 2e94b05c27

View File

@ -146,6 +146,7 @@ PYBIND11_MODULE(_pywrap_tf_cluster, m) {
std::vector<tensorflow::OpDef> ops;
registry->GetRegisteredOps(&ops);
std::vector<std::string> op_names;
op_names.reserve(ops.size());
for (const tensorflow::OpDef& op : ops) {
op_names.push_back(op.name());
}