message: Use `str_util::EndsWith` to find suffixes in latency_all_edges.cc.
diff: @@ -24,6 +24,7 @@ limitations under the License.
  #include "tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.h"
  #include "tensorflow/core/grappler/optimizers/data/graph_utils.h"
  #include "tensorflow/core/grappler/utils.h"
  +#include "tensorflow/core/lib/strings/str_util.h"
  #include "tensorflow/core/platform/logging.h"
  #include "tensorflow/core/platform/protobuf.h"
  @@ -72,10 +73,8 @@ Status LatencyAllEdges::Optimize(Cluster* cluster, const GrapplerItem& item,
  // TODO(shivaniagrawal): Add Op to return Latency for the particular Op than
  // for the edge (e2 - e1?).
  for (const NodeDef& node : item.graph.node()) {
  - if (node.op().rfind("Dataset") != node.op().size() - strlen("Dataset") ||
  - node.attr().empty() ||
  - node.name().rfind("_generated") ==
  - node.name().size() - strlen("_generated")) {
  + if (!str_util::EndsWith(node.op(), "Dataset") || node.attr().empty() ||
  + str_util::EndsWith(node.name(), "_generated")) {
  // TODO(b/111805951): Replace this with non-approximate way to check if
  // node corresponds to a `Dataset` op.
  continue;
  @@ -89,8 +88,7 @@ Status LatencyAllEdges::Optimize(Cluster* cluster, const GrapplerItem& item,
  } else { // fanout will have size 0 for last dataset node in the pipeline.
  if (fanout.size() == 1) {
  NodeDef* output_node = (*(fanout.begin())).node;
  - if (output_node->name().rfind("_generated") ==
  - output_node->name().size() - strlen("_generated")) {
  + if (str_util::EndsWith(output_node->name(), "_generated")) {
  continue;
  }
  }
  