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

Function find_cycle

tensorflow/python/framework/test_util.py:768–781  ·  view source on GitHub ↗

Finds and prints a single cycle in the dependency graph.

(el, graph, reprs, path)

Source from the content-addressed store, hash-verified

766 reprs[r_id] = describe(r, blacklist)
767
768 def find_cycle(el, graph, reprs, path):
769 """Finds and prints a single cycle in the dependency graph."""
770 if el not in graph:
771 return
772 for r in graph[el]:
773 if r in path:
774 logging.error("Reference cycle sample:")
775 for p in path + (r,):
776 logging.error(reprs.get(p, "unknown object " + str(p)))
777 return True
778 else:
779 if find_cycle(r, graph, reprs, path + (r,)):
780 return True
781 return False
782
783 obj = objects[idx]
784 graph = {} # referrer ID -> object ID

Callers 1

_find_reference_cycleFunction · 0.85

Calls 2

errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected