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/framework | |
parent | d8f64b90e6f0bfec5135bdf99e42b8fdaf53788d (diff) |
Removed redundant std::string -> string conversions.
PiperOrigin-RevId: 210565027
Diffstat (limited to 'tensorflow/core/framework')
-rw-r--r-- | tensorflow/core/framework/function.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/framework/node_def_builder.cc | 17 | ||||
-rw-r--r-- | tensorflow/core/framework/node_def_util.cc | 6 | ||||
-rw-r--r-- | tensorflow/core/framework/op_def_builder.cc | 4 | ||||
-rw-r--r-- | tensorflow/core/framework/op_gen_lib.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/framework/op_kernel.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/framework/shape_inference_testutil.h | 2 |
7 files changed, 17 insertions, 18 deletions
diff --git a/tensorflow/core/framework/function.cc b/tensorflow/core/framework/function.cc index 6b92e10d76..26f32677af 100644 --- a/tensorflow/core/framework/function.cc +++ b/tensorflow/core/framework/function.cc @@ -504,7 +504,7 @@ string Print(const NodeDef& n) { std::vector<string> dep; for (StringPiece s : n.input()) { if (str_util::ConsumePrefix(&s, "^")) { - dep.push_back(std::string(s)); + dep.emplace_back(s); } else { dat.push_back(s); } diff --git a/tensorflow/core/framework/node_def_builder.cc b/tensorflow/core/framework/node_def_builder.cc index 8e00bfe4f8..348a825af9 100644 --- a/tensorflow/core/framework/node_def_builder.cc +++ b/tensorflow/core/framework/node_def_builder.cc @@ -24,23 +24,22 @@ limitations under the License. namespace tensorflow { NodeDefBuilder::NodeOut::NodeOut(StringPiece n, int i, DataType dt) - : node(std::string(n)), index(i), data_type(dt) {} + : node(n), index(i), data_type(dt) {} NodeDefBuilder::NodeOut::NodeOut() { // uninitialized, call Reset() before use. } void NodeDefBuilder::NodeOut::Reset(StringPiece n, int i, DataType dt) { - node = std::string(n); + node = string(n); index = i; data_type = dt; } NodeDefBuilder::NodeDefBuilder(StringPiece name, StringPiece op_name, const OpRegistryInterface* op_registry) { - node_def_.set_name(std::string(name)); - const Status status = - op_registry->LookUpOpDef(std::string(op_name), &op_def_); + node_def_.set_name(string(name)); + const Status status = op_registry->LookUpOpDef(string(op_name), &op_def_); if (status.ok()) { Initialize(); } else { @@ -51,7 +50,7 @@ NodeDefBuilder::NodeDefBuilder(StringPiece name, StringPiece op_name, NodeDefBuilder::NodeDefBuilder(StringPiece name, const OpDef* op_def) : op_def_(op_def) { - node_def_.set_name(std::string(name)); + node_def_.set_name(string(name)); Initialize(); } @@ -171,7 +170,7 @@ void NodeDefBuilder::AddInput(StringPiece src_node, int src_index) { } else if (src_index > 0) { node_def_.add_input(strings::StrCat(src_node, ":", src_index)); } else { - node_def_.add_input(std::string(src_node)); + node_def_.add_input(string(src_node)); } } @@ -194,12 +193,12 @@ void NodeDefBuilder::VerifyInputRef(const OpDef::ArgDef* input_arg, } NodeDefBuilder& NodeDefBuilder::ControlInput(StringPiece src_node) { - control_inputs_.push_back(std::string(src_node)); + control_inputs_.emplace_back(src_node); return *this; } NodeDefBuilder& NodeDefBuilder::Device(StringPiece device_spec) { - node_def_.set_device(std::string(device_spec)); + node_def_.set_device(string(device_spec)); return *this; } diff --git a/tensorflow/core/framework/node_def_util.cc b/tensorflow/core/framework/node_def_util.cc index 0bd79366eb..bacc1d72c4 100644 --- a/tensorflow/core/framework/node_def_util.cc +++ b/tensorflow/core/framework/node_def_util.cc @@ -254,7 +254,7 @@ DEFINE_GET_ATTR(NameAttrList, func, "func", emplace_back, v, ;); #undef DEFINE_GET_ATTR bool HasNodeAttr(const NodeDef& node_def, StringPiece attr_name) { - return node_def.attr().find(std::string(attr_name)) != node_def.attr().end(); + return node_def.attr().find(string(attr_name)) != node_def.attr().end(); } static const string& kEmptyString = *new string(); @@ -653,7 +653,7 @@ Status AttachDef(const Status& status, const Node& node) { void AddNodeAttr(StringPiece name, const AttrValue& value, NodeDef* node_def) { node_def->mutable_attr()->insert( - AttrValueMap::value_type(std::string(name), value)); + AttrValueMap::value_type(string(name), value)); } #define ADD_NODE_ATTR(T) \ @@ -691,7 +691,7 @@ ADD_NODE_ATTR(gtl::ArraySlice<NameAttrList>) #undef ADD_NODE_ATTR void AddAttr(StringPiece name, const AttrValue& value, AttrValueMap* map) { - map->insert(AttrValueMap::value_type(std::string(name), value)); + map->insert(AttrValueMap::value_type(string(name), value)); } #define ADD_ATTR(T) \ diff --git a/tensorflow/core/framework/op_def_builder.cc b/tensorflow/core/framework/op_def_builder.cc index 91eb6c0672..34a7a43d38 100644 --- a/tensorflow/core/framework/op_def_builder.cc +++ b/tensorflow/core/framework/op_def_builder.cc @@ -527,7 +527,7 @@ void FinalizeDoc(const string& text, OpDef* op_def, } // namespace OpDefBuilder::OpDefBuilder(StringPiece op_name) { - op_def()->set_name(std::string(op_name)); // NOLINT + op_def()->set_name(string(op_name)); // NOLINT } OpDefBuilder& OpDefBuilder::Attr(StringPiece spec) { @@ -584,7 +584,7 @@ OpDefBuilder& OpDefBuilder::Deprecated(int version, StringPiece explanation) { } else { OpDeprecation* deprecation = op_def()->mutable_deprecation(); deprecation->set_version(version); - deprecation->set_explanation(std::string(explanation)); + deprecation->set_explanation(string(explanation)); } return *this; } diff --git a/tensorflow/core/framework/op_gen_lib.cc b/tensorflow/core/framework/op_gen_lib.cc index 4b56d807df..505ab54775 100644 --- a/tensorflow/core/framework/op_gen_lib.cc +++ b/tensorflow/core/framework/op_gen_lib.cc @@ -186,7 +186,7 @@ static bool FindMultiline(StringPiece line, size_t colon, string* end) { while (str_util::ConsumePrefix(&line, " ")) { } if (str_util::ConsumePrefix(&line, "<<")) { - *end = std::string(line); + *end = string(line); return true; } return false; diff --git a/tensorflow/core/framework/op_kernel.cc b/tensorflow/core/framework/op_kernel.cc index b285accce7..c694e10193 100644 --- a/tensorflow/core/framework/op_kernel.cc +++ b/tensorflow/core/framework/op_kernel.cc @@ -913,7 +913,7 @@ void OpKernelContext::clear_recorded_memory() { struct KernelRegistration { KernelRegistration(const KernelDef& d, StringPiece c, kernel_factory::OpKernelRegistrar::Factory f) - : def(d), kernel_class_name(std::string(c)), factory(f) {} + : def(d), kernel_class_name(c), factory(f) {} const KernelDef def; const string kernel_class_name; const kernel_factory::OpKernelRegistrar::Factory factory; diff --git a/tensorflow/core/framework/shape_inference_testutil.h b/tensorflow/core/framework/shape_inference_testutil.h index f6656b3b45..bb4dc25da4 100644 --- a/tensorflow/core/framework/shape_inference_testutil.h +++ b/tensorflow/core/framework/shape_inference_testutil.h @@ -32,7 +32,7 @@ class Tensor; struct ShapeInferenceTestOp { typedef std::pair<string, DataType> ShapeAndType; - explicit ShapeInferenceTestOp(StringPiece name) : name(std::string(name)) {} + explicit ShapeInferenceTestOp(StringPiece name) : name(string(name)) {} string name; NodeDef node_def; std::vector<const Tensor*> input_tensors; |