in tensorwatch/model_graph/hiddenlayer/summary_graph.py [0:0]
def successors_f(self, node_name, successors_types, done_list=None, logging=None, denorm_names=True):
"""Returns a list of <op>'s successors, if they match the <successors_types> criteria.
Traverse the graph, starting at node <node_name>, and search for successor
nodes, that have one of the node types listed in <successors_types>.
If none is found, then return an empty list.
<node_name> and the returned list of successors are strings, because
"""
node_name = distiller.normalize_module_name(node_name)
node = self.find_op(node_name)
node_is_an_op = True
if node is None:
node_is_an_op = False
node = self.find_param(node_name)
if node is None:
msglogger.warning("successors_f: Could not find node {}".format(node_name))
return []
if done_list is None:
done_list = []
done_list.append(node_name)
if not isinstance(successors_types, list):
successors_types = [successors_types]
if node_is_an_op:
# We check if we found the type of node we're looking for,
# and that this is not the first node in our search.
if node['type'] in successors_types and len(done_list) > 1:
return [distiller.denormalize_module_name(self._src_model, node_name) if denorm_names else node_name]
# This is an operation node
succs = [edge.dst for edge in self.edges if (edge.src == node_name and
edge.dst not in done_list)]
else:
# This is a data node
succs = [edge.dst for edge in self.edges if (edge.src == node_name and
edge.dst not in done_list)]
ret = []
for successor in succs:
ret += self.successors_f(successor, successors_types, done_list, logging, denorm_names)
return ret