diff options
author | 2017-06-01 09:42:04 -0700 | |
---|---|---|
committer | 2017-06-01 09:45:21 -0700 | |
commit | eb10a4c494d95e7c17ddc44ef35197d08f2f6b33 (patch) | |
tree | c920e61142ba74b437c3c39036a4748ba575b039 /tensorflow/core/framework/shape_inference.cc | |
parent | ce32228c49e595f966485acee947131e4ab04905 (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.cc | 1 |
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); } |