message: Sort edges in convert graph as well
diff: @@ -323,6 +323,13 @@ tensorflow::Status ConvertGraphDefToTensorRT(
  return Status::OK();
  }
  +struct EdgePtrCompare {
  + bool operator()(const tensorflow::Edge* lhs,
  + const tensorflow::Edge* rhs) const {
  + return (lhs->id() < rhs->id());
  + }
  +};
  +
  // Function to get subsegment information structure.
  tensorflow::Status GetEngineInfo(
  const tensorflow::Graph* g,
  @@ -361,8 +368,12 @@ tensorflow::Status GetEngineInfo(
  }
  const int node_id = node->id();
  subgraph_node_ids.push_back(node_id);
  - // Create input connections.
  - for (const auto edge : node->in_edges()) {
  + // Create input connections. Sort edges first to make determnistic since
  + // in_edges is a set of pointers.
  + std::vector<const tensorflow::Edge*> in_edges(node->in_edges().begin(),
  + node->in_edges().end());
  + std::sort(in_edges.begin(), in_edges.end(), EdgePtrCompare());
  + for (const auto edge : in_edges) {
  auto input_node = edge->src();
  if (input_node->IsSource() || segment_nodes.count(input_node->name())) {
  continue;
  @@ -410,8 +421,12 @@ tensorflow::Status GetEngineInfo(
  node_id, edge->dst_input(), /*input_edge=*/true, port);
  }
  }
  - // Create output connections.
  - for (const auto edge : node->out_edges()) {
  + // Create output connections. Sort edges first to make determnistic since
  + // out_edges is a set of pointers.
  + std::vector<const tensorflow::Edge*> out_edges(node->out_edges().begin(),
  + node->out_edges().end());
  + std::sort(out_edges.begin(), out_edges.end(), EdgePtrCompare());
  + for (const auto edge : out_edges) {
  auto output_node = edge->dst();
  if (output_node->IsSink() || segment_nodes.count(output_node->name())) {
  continue;
  