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

Function _in_op_degree

tensorflow/python/tpu/tensor_tracer_report.py:72–87  ·  view source on GitHub ↗

Returns the number of incoming edges to the given op. The edge calculation skips the edges that come from 'NextIteration' ops. NextIteration creates a cycle in the graph. We break cycles by treating this op as 'sink' and ignoring all outgoing edges from it. Args: op: Tf.Operat

(op)

Source from the content-addressed store, hash-verified

70 return op.type in ['NextIteration']
71
72 def _in_op_degree(op):
73 """Returns the number of incoming edges to the given op.
74
75 The edge calculation skips the edges that come from 'NextIteration' ops.
76 NextIteration creates a cycle in the graph. We break cycles by treating
77 this op as 'sink' and ignoring all outgoing edges from it.
78 Args:
79 op: Tf.Operation
80 Returns:
81 the number of incoming edges.
82 """
83 count = 0
84 for op in op.control_inputs + [in_tensor.op for in_tensor in op.inputs]:
85 if not _is_loop_edge(op):
86 count += 1
87 return count
88
89 sorted_ops = []
90 op_in_degree = {op: _in_op_degree(op) for op in g.get_operations()}

Callers 1

topological_sortFunction · 0.85

Calls 1

_is_loop_edgeFunction · 0.85

Tested by

no test coverage detected