diff options
Diffstat (limited to 'tensorflow/core/framework/node_def_util.cc')
-rw-r--r-- | tensorflow/core/framework/node_def_util.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/core/framework/node_def_util.cc b/tensorflow/core/framework/node_def_util.cc index 95fb386314..bad92ca9b3 100644 --- a/tensorflow/core/framework/node_def_util.cc +++ b/tensorflow/core/framework/node_def_util.cc @@ -31,6 +31,7 @@ limitations under the License. #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/lib/gtl/map_util.h" #include "tensorflow/core/lib/strings/scanner.h" +#include "tensorflow/core/lib/strings/str_util.h" #include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/core/platform/protobuf.h" @@ -131,7 +132,7 @@ Status AttrSlice::Find(StringPiece attr_name, // Skip AttachDef for internal attrs since it is a little bit // expensive and it is common for them to correctly not be included // in a NodeDef. - if (!attr_name.starts_with("_") && ndef_ != nullptr) { + if (!str_util::StartsWith(attr_name, "_") && ndef_ != nullptr) { s = AttachDef(s, *ndef_); } return s; @@ -399,7 +400,7 @@ Status ValidateNodeDef(const NodeDef& node_def, const OpDef& op_def) { size_t num_inputs = 0; // TODO(josh11b): Unify the input field validation. for (const string& input : node_def.input()) { - if (StringPiece(input).starts_with("^")) { + if (str_util::StartsWith(input, "^")) { seen_control = true; if (input.find(':') != string::npos) { return errors::InvalidArgument( @@ -425,7 +426,7 @@ Status ValidateNodeDef(const NodeDef& node_def, const OpDef& op_def) { } for (const auto& attr : node_def.attr()) { // Allow internal optional attributes with names starting with "_". - if (StringPiece(attr.first).starts_with("_")) { + if (str_util::StartsWith(attr.first, "_")) { continue; } auto iter = op_attrs.find(attr.first); |