MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / FixupSourceAndSinkEdges

Function FixupSourceAndSinkEdges

tensorflow/core/graph/algorithm.cc:245–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245bool FixupSourceAndSinkEdges(Graph* g) {
246 // Connect all nodes with no incoming edges to source.
247 // Connect all nodes with no outgoing edges to sink.
248 bool changed = false;
249 for (Node* n : g->nodes()) {
250 if (!n->IsSource() && n->in_edges().empty()) {
251 g->AddControlEdge(g->source_node(), n,
252 true /* skip test for duplicates */);
253 changed = true;
254 }
255 if (!n->IsSink() && n->out_edges().empty()) {
256 g->AddControlEdge(n, g->sink_node(), true /* skip test for duplicates */);
257 changed = true;
258 }
259 }
260 return changed;
261}
262
263std::unordered_set<const Node*> FindExcludeDuplicationNodes(Graph* g,
264 std::unordered_set<const Node*>& visited) {

Callers 15

ConvertMethod · 0.85
FunctionalizeLoopFunction · 0.85
TESTFunction · 0.85
CompileSingleOpMethod · 0.85
RewriteAndPruneGraphFunction · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
SplitIntoSubgraphsMethod · 0.85
ConvertToAsyncOutFunction · 0.85
TESTFunction · 0.85

Calls 7

IsSourceMethod · 0.80
IsSinkMethod · 0.80
nodesMethod · 0.45
emptyMethod · 0.45
AddControlEdgeMethod · 0.45
source_nodeMethod · 0.45
sink_nodeMethod · 0.45

Tested by 15

TESTFunction · 0.68
TEST_FFunction · 0.68
TESTFunction · 0.68
ConvertToAsyncOutFunction · 0.68
TESTFunction · 0.68
BuildCgmodeOpsFunction · 0.68
PartiallyDeclusterFunction · 0.68
BuildXlaOpsFunction · 0.68
ComputeIncompatiblePairsFunction · 0.68
ClusterScopingFunction · 0.68
AnalyzeDeadnessFunction · 0.68
TESTFunction · 0.68