Gets the minimum depth at which node can be computed.
(node)
| 1547 | network_nodes = set(relevant_nodes + list(node_to_depth.keys())) |
| 1548 | |
| 1549 | def _get_min_depth(node): |
| 1550 | """Gets the minimum depth at which node can be computed.""" |
| 1551 | min_depth = 0 |
| 1552 | for layer, node_id, _, _ in node.iterate_inbound(include_arguments=True): |
| 1553 | inbound_node = layer._inbound_nodes[node_id] |
| 1554 | if inbound_node in node_to_depth: |
| 1555 | min_depth = min(min_depth, node_to_depth[inbound_node]) |
| 1556 | elif inbound_node not in network_nodes: |
| 1557 | continue |
| 1558 | else: |
| 1559 | # Previous relevant nodes haven't been processed yet. |
| 1560 | return None |
| 1561 | # New node is one shallower than its shallowest input. |
| 1562 | return min_depth - 1 |
| 1563 | |
| 1564 | # Insert nodes into `_nodes_by_depth` and other node attrs. |
| 1565 | unprocessed_nodes = copy.copy(relevant_nodes) |
nothing calls this directly
no test coverage detected