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

Method _visit_internal

tensorflow/python/autograph/pyct/cfg.py:200–222  ·  view source on GitHub ↗

Visits the CFG, depth-first.

(self, mode)

Source from the content-addressed store, hash-verified

198 }
199
200 def _visit_internal(self, mode):
201 """Visits the CFG, depth-first."""
202 assert mode in (_WalkMode.FORWARD, _WalkMode.REVERSE)
203 if mode == _WalkMode.FORWARD:
204 open_ = [self.graph.entry]
205 elif mode == _WalkMode.REVERSE:
206 open_ = list(self.graph.exit)
207 closed = set()
208
209 while open_:
210 node = open_.pop(0)
211 closed.add(node)
212
213 should_revisit = self.visit_node(node)
214
215 if mode == _WalkMode.FORWARD:
216 children = node.next
217 elif mode == _WalkMode.REVERSE:
218 children = node.prev
219
220 for next_ in children:
221 if should_revisit or next_ not in closed:
222 open_.append(next_)
223
224 def visit_forward(self):
225 self._visit_internal(_WalkMode.FORWARD)

Callers 2

visit_forwardMethod · 0.95
visit_reverseMethod · 0.95

Calls 4

visit_nodeMethod · 0.95
popMethod · 0.45
addMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected