def find_up(l_node, f_node):
 if isinstance(l_node, gof.Apply):
  l_outs = l_node.outputs
 else:
  l_outs = l_node
 l_ins = gof.graph.inputs(l_outs)
 nodes = gof.graph.io_toposort(l_ins, l_outs)
 return (f_node in nodes)

def find_up ( l_node , f_node ) : if isinstance ( l_node , gof . Apply ) : l_outs = l_node . outputs else : l_outs = l_node l_ins = gof . graph . inputs ( l_outs ) nodes = gof . graph . io_toposort ( l_ins , l_outs ) return ( f_node in nodes )
goes up in the graph and returns true if a node in nodes is found .