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/framework | |
parent | ce32228c49e595f966485acee947131e4ab04905 (diff) |
Preallocate vector storage when the ultimate vector size is known in advance
PiperOrigin-RevId: 157724431
Diffstat (limited to 'tensorflow/cc/framework')
-rw-r--r-- | tensorflow/cc/framework/gradient_checker.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/cc/framework/gradient_checker.cc b/tensorflow/cc/framework/gradient_checker.cc index 8f20ff1457..b8e5411bf7 100644 --- a/tensorflow/cc/framework/gradient_checker.cc +++ b/tensorflow/cc/framework/gradient_checker.cc @@ -44,6 +44,7 @@ Status ComputeTheoreticalJacobianTranspose( size_t x_num = x_shapes.size(); // Call AddSymbolicGradients to get 'dxs' (we will feed 'dys'). OutputList dys; + dys.reserve(y_shapes.size()); for (const auto& y_shape : y_shapes) { // TODO(suharshs): This currently assumes that all x's are the same type. dys.push_back(Cast(scope, Const(scope, 1.0, y_shape), xs[0].type())); |