aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler/optimizers/loop_optimizer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/grappler/optimizers/loop_optimizer.cc')
-rw-r--r--tensorflow/core/grappler/optimizers/loop_optimizer.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/core/grappler/optimizers/loop_optimizer.cc b/tensorflow/core/grappler/optimizers/loop_optimizer.cc
index 8f13c4a702..244653504d 100644
--- a/tensorflow/core/grappler/optimizers/loop_optimizer.cc
+++ b/tensorflow/core/grappler/optimizers/loop_optimizer.cc
@@ -25,7 +25,6 @@ limitations under the License.
#include "tensorflow/core/framework/attr_value.pb.h"
#include "tensorflow/core/framework/node_def.pb.h"
#include "tensorflow/core/framework/op.h"
-#include "tensorflow/core/framework/tensor_shape.pb.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/grappler/costs/graph_properties.h"
#include "tensorflow/core/grappler/grappler_item.h"
@@ -409,7 +408,7 @@ Status LoopOptimizer::LoopInvariantNodeMotion() {
frame_children_[frame_ids[0]].insert(frame_ids[1]);
frame_parent_[frame_ids.back()] = frame_ids[frame_ids.size() - 2];
}
- if (frame_ids.size() >= 1) {
+ if (!frame_ids.empty()) {
frame_children_.insert(std::make_pair(frame_ids.back(), empty_set_));
if (node->op() == "LoopCond") {
if (loop_cond_.count(frame_ids.back())) {
@@ -428,7 +427,7 @@ Status LoopOptimizer::LoopInvariantNodeMotion() {
}
for (auto it = frame_children_.begin(); it != frame_children_.end(); ++it) {
- if (it->second.size() == 0) {
+ if (it->second.empty()) {
worklist.push_back(it->first);
}
}
@@ -441,7 +440,7 @@ Status LoopOptimizer::LoopInvariantNodeMotion() {
if (parent_it != frame_parent_.end()) {
int parent_id = parent_it->second;
frame_children_[parent_id].erase(frame_id);
- if (frame_children_[parent_id].size() == 0) {
+ if (frame_children_[parent_id].empty()) {
worklist.push_back(parent_id);
}
}
@@ -465,6 +464,7 @@ Status LoopOptimizer::LoopInvariantNodeMotion() {
Status LoopOptimizer::Optimize(Cluster* cluster, const GrapplerItem& item,
GraphDef* optimized_graph) {
TF_RETURN_IF_ERROR(RemoveStackOps(item.graph, optimized_graph));
+
optimized_graph_ = optimized_graph;
// Set up helper data structures.