aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/framework
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-07-25 11:46:49 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-07-25 11:50:54 -0700
commite8e406f64674a52619767e9715d218d4c00ff7ea (patch)
tree645b1c09d52f081dfccc322b28eff872c4b2d408 /tensorflow/cc/framework
parentf8ecc882508fc4807d106cd247e558a2d33a128a (diff)
Minor tweaks to avoid unnecessary copies
PiperOrigin-RevId: 163101160
Diffstat (limited to 'tensorflow/cc/framework')
-rw-r--r--tensorflow/cc/framework/gradients.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/cc/framework/gradients.cc b/tensorflow/cc/framework/gradients.cc
index cec3ebc0ad..66a943410e 100644
--- a/tensorflow/cc/framework/gradients.cc
+++ b/tensorflow/cc/framework/gradients.cc
@@ -356,7 +356,7 @@ Status SymbolicGradientBuilder::AddGradients() {
// Check if any input nodes still have pending gradients and have not been
// processed yet. This happens if not all outputs of a node are in 'inputs_'.
std::unordered_map<Node*, int> requested_grads;
- for (Output nout : inputs_) {
+ for (const Output& nout : inputs_) {
if (pending_[nout.node()->id()] > 0) {
DCHECK_GT(nout.node()->num_outputs(), 1);
int idx = input_nodes_[nout];
@@ -365,7 +365,7 @@ Status SymbolicGradientBuilder::AddGradients() {
++requested_grads[nout.node()];
}
}
- for (auto& p : requested_grads) {
+ for (const auto& p : requested_grads) {
int num_requested_inputs = p.first->num_outputs() - pending_[p.first->id()];
CHECK_EQ(num_requested_inputs, p.second);
}