[EP ABI] Update Graph_GetGraphView() implementation
Description
In some cases, e.g. when model has a node that produces output consumed by multiple nodes, calling the current implementation of Graph_GetGraphView() to get a subgraph returns incorrect OrtGraph.
This PR fixes the issue.
-
Original graph:
-
Incorrect graph after calling
Graph_GetGraphView()to get the subgraph:It includes three of the nodes from the original graph. The
topk_indicesis the output of theTopKand it shouldn't be added as a graph input shown in the graph below. The API implementation has issue handling this case. If we feed this subgraph into TRT parser, it would fail to parse the graph. -
Correct graph after calling
Graph_GetGraphView()to get the subgraph:It includes three of the nodes from the original graph. The
topk_indicesnow is not added as a graph input. Instead, thetopk_indicesis added as a graph output which is expected asModis in another subgraph that consumes it, so this subgraph has to maketopk_indicesa graph output.