diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-28 10:36:25 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-28 10:43:43 -0700 |
commit | 4f4e1b48862c30a21dedffb7a1929a2b2600ec9f (patch) | |
tree | 9b10bb2e00dde7890b4dcd1ddc6fb18698bf00d2 /tensorflow/core/graph | |
parent | d8f64b90e6f0bfec5135bdf99e42b8fdaf53788d (diff) |
Removed redundant std::string -> string conversions.
PiperOrigin-RevId: 210565027
Diffstat (limited to 'tensorflow/core/graph')
-rw-r--r-- | tensorflow/core/graph/graph.cc | 4 | ||||
-rw-r--r-- | tensorflow/core/graph/graph_constructor.cc | 10 | ||||
-rw-r--r-- | tensorflow/core/graph/graph_constructor_test.cc | 5 | ||||
-rw-r--r-- | tensorflow/core/graph/graph_def_builder.cc | 4 | ||||
-rw-r--r-- | tensorflow/core/graph/graph_def_builder.h | 2 | ||||
-rw-r--r-- | tensorflow/core/graph/graph_partition.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/graph/node_builder.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/graph/while_context.cc | 2 |
8 files changed, 15 insertions, 16 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc index 568f0870c0..ade9266231 100644 --- a/tensorflow/core/graph/graph.cc +++ b/tensorflow/core/graph/graph.cc @@ -483,7 +483,7 @@ const Edge* Graph::AddControlEdge(Node* source, Node* dest, void Graph::RemoveControlEdge(const Edge* e) { if (!e->src_->IsSource() && !e->dst_->IsSink()) { e->dst_->MaybeCopyOnWrite(); - std::string e_src_name = strings::StrCat("^", e->src_->name()); + string e_src_name = strings::StrCat("^", e->src_->name()); auto* inputs = e->dst_->props_->node_def.mutable_input(); for (auto it = inputs->begin(); it != inputs->end(); ++it) { if (*it == e_src_name) { @@ -721,7 +721,7 @@ Status Graph::AddWhileContext(StringPiece frame_name, std::vector<OutputTensor> body_outputs, WhileContext** result) { auto pair = while_ctxs_.insert(std::pair<string, WhileContext>( - std::string(frame_name), + string(frame_name), WhileContext(frame_name, std::move(enter_nodes), std::move(exit_nodes), cond_output, std::move(body_inputs), std::move(body_outputs)))); diff --git a/tensorflow/core/graph/graph_constructor.cc b/tensorflow/core/graph/graph_constructor.cc index 8c73f8f712..ee10194142 100644 --- a/tensorflow/core/graph/graph_constructor.cc +++ b/tensorflow/core/graph/graph_constructor.cc @@ -513,7 +513,7 @@ Status GraphConstructor::InitFromEdges() { num_control_edges++; } else { TensorId id(ParseTensorName(input_name)); - if (next_iteration_nodes_.find(std::string(id.first)) != + if (next_iteration_nodes_.find(string(id.first)) != next_iteration_nodes_.end()) { has_loop_back_edge = true; } @@ -835,7 +835,7 @@ void GraphConstructor::UniquifyNames( // We require that UniquifyNames() is called on all NodeDefs in topological // order. This guarantees that node_def's inputs will already be uniquified // if necessary. - auto iter = uniquified_names_.find(std::string(id.first)); + auto iter = uniquified_names_.find(string(id.first)); if (iter == uniquified_names_.end()) continue; id.first = iter->second; node_def->set_input(i, id.ToString()); @@ -854,7 +854,7 @@ void GraphConstructor::UpdateUniquifiedColocationNames() { for (int i = 0; i < coloc_values.size(); ++i) { StringPiece val(coloc_values[i]); if (str_util::ConsumePrefix(&val, kColocationGroupPrefix)) { - const auto& name_pair = uniquified_names_.find(std::string(val)); + const auto& name_pair = uniquified_names_.find(string(val)); if (name_pair == uniquified_names_.end()) continue; updated = true; coloc_values[i] = @@ -880,7 +880,7 @@ bool GraphConstructor::NameExistsInGraphDef(StringPiece name) { } string GraphConstructor::FindUniqueName(StringPiece original_name) { - string name = std::string(original_name); + string name(original_name); int count = 0; // Check that any generated names don't collide with imported NodeDefs (as // well as nodes in g_). @@ -997,7 +997,7 @@ Status GraphConstructor::Convert() { src_node->num_outputs(), " outputs"); } - inputs.emplace_back(std::string(id.first), src_node, src_index); + inputs.emplace_back(string(id.first), src_node, src_index); } if (has_data_back_edge && !IsMerge(*node_def)) { diff --git a/tensorflow/core/graph/graph_constructor_test.cc b/tensorflow/core/graph/graph_constructor_test.cc index e338840eeb..73142ebde7 100644 --- a/tensorflow/core/graph/graph_constructor_test.cc +++ b/tensorflow/core/graph/graph_constructor_test.cc @@ -156,9 +156,8 @@ class GraphConstructorTest : public ::testing::Test { return ""; } StringPiece loc(value[0]); - return str_util::ConsumePrefix(&loc, kColocationGroupPrefix) - ? std::string(loc) - : ""; + return str_util::ConsumePrefix(&loc, kColocationGroupPrefix) ? string(loc) + : ""; } string GraphDebugString() const { diff --git a/tensorflow/core/graph/graph_def_builder.cc b/tensorflow/core/graph/graph_def_builder.cc index dd84c4f7c7..6d5df7efba 100644 --- a/tensorflow/core/graph/graph_def_builder.cc +++ b/tensorflow/core/graph/graph_def_builder.cc @@ -44,12 +44,12 @@ GraphDefBuilder::Options GraphDefBuilder::Options::WithControlInputs( } GraphDefBuilder::Options GraphDefBuilder::Options::WithNameImpl( StringPiece name) { - name_ = std::string(name); + name_ = string(name); return *this; } GraphDefBuilder::Options GraphDefBuilder::Options::WithDeviceImpl( StringPiece device) { - device_ = std::string(device); + device_ = string(device); return *this; } GraphDefBuilder::Options GraphDefBuilder::Options::WithControlInputImpl( diff --git a/tensorflow/core/graph/graph_def_builder.h b/tensorflow/core/graph/graph_def_builder.h index ec131580ae..400d8b6c84 100644 --- a/tensorflow/core/graph/graph_def_builder.h +++ b/tensorflow/core/graph/graph_def_builder.h @@ -128,7 +128,7 @@ class GraphDefBuilder { Options WithControlInputsImpl(gtl::ArraySlice<Node*> control_inputs); template <class T> Options WithAttrImpl(StringPiece name, T&& value) { - attrs_.emplace_back(std::string(name), AttrValue()); + attrs_.emplace_back(string(name), AttrValue()); SetAttrValue(std::forward<T>(value), &attrs_.back().second); return *this; } diff --git a/tensorflow/core/graph/graph_partition.cc b/tensorflow/core/graph/graph_partition.cc index ea0a814ab8..1dbcebab59 100644 --- a/tensorflow/core/graph/graph_partition.cc +++ b/tensorflow/core/graph/graph_partition.cc @@ -793,7 +793,7 @@ Status TopologicalSortNodesWithTimePriority( for (int n = 0; n < gdef->node_size(); ++n) { const NodeDef* ndef = &gdef->node(n); for (int i = 0; i < ndef->input_size(); ++i) { - node_to_output_nodes[std::string(ParseTensorName(ndef->input(i)).first)] + node_to_output_nodes[string(ParseTensorName(ndef->input(i)).first)] .push_back(ndef); } int64 start_time; diff --git a/tensorflow/core/graph/node_builder.cc b/tensorflow/core/graph/node_builder.cc index 03f3bbd663..a446e0d136 100644 --- a/tensorflow/core/graph/node_builder.cc +++ b/tensorflow/core/graph/node_builder.cc @@ -30,7 +30,7 @@ NodeBuilder::NodeOut::NodeOut(Node* n, int32 i) // NOLINT(runtime/explicit) dt(SafeGetOutput(node, i, &error)) {} NodeBuilder::NodeOut::NodeOut(StringPiece n, int32 i, DataType t) - : node(nullptr), error(false), name(std::string(n)), index(i), dt(t) {} + : node(nullptr), error(false), name(n), index(i), dt(t) {} NodeBuilder::NodeOut::NodeOut() : node(nullptr), error(true), index(0), dt(DT_FLOAT) {} diff --git a/tensorflow/core/graph/while_context.cc b/tensorflow/core/graph/while_context.cc index 1b38aac35d..8e89bc4c75 100644 --- a/tensorflow/core/graph/while_context.cc +++ b/tensorflow/core/graph/while_context.cc @@ -23,7 +23,7 @@ WhileContext::WhileContext(StringPiece frame_name, OutputTensor cond_output, std::vector<OutputTensor> body_inputs, std::vector<OutputTensor> body_outputs) - : frame_name_(std::string(frame_name)), + : frame_name_(frame_name), enter_nodes_(std::move(enter_nodes)), exit_nodes_(std::move(exit_nodes)), cond_output_(cond_output), |