aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/framework/shape_inference.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/framework/shape_inference.cc
parentce32228c49e595f966485acee947131e4ab04905 (diff)
Preallocate vector storage when the ultimate vector size is known in advance
PiperOrigin-RevId: 157724431
Diffstat (limited to 'tensorflow/core/framework/shape_inference.cc')
-rw-r--r--tensorflow/core/framework/shape_inference.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/core/framework/shape_inference.cc b/tensorflow/core/framework/shape_inference.cc
index 2cbbf966b8..6ad464cc61 100644
--- a/tensorflow/core/framework/shape_inference.cc
+++ b/tensorflow/core/framework/shape_inference.cc
@@ -565,6 +565,7 @@ Status InferenceContext::MakeShapeFromTensor(const Tensor* t,
}
const auto num_dims = Value(shape_dim);
std::vector<DimensionHandle> dims;
+ dims.reserve(num_dims);
for (int i = 0; i < num_dims; i++) dims.push_back(UnknownDim());
return ReturnCreatedShape(dims, out);
}