code: def test_dependence():
      dependence = make_dependence_cmp()
  
      x = tensor.matrix("x")
      y = tensor.dot(x * 2, x + 1)
      nodes = io_toposort([x], [y])
  
      for a, b in zip(nodes[:-1], nodes[1:]):
          assert dependence(a, b) <= 0
  
file_path: Theano/theano/gof/tests/test_sched.py
imports: from __future__ import absolute_import, print_function, division
  from theano.gof.sched import make_dependence_cmp, sort_apply_nodes, reverse_dict, _toposort, posort
  from theano import tensor
  from theano.gof.graph import io_toposort
  from theano.compat import cmp
label_desc: Use image node_id 1 for calling a global function with example usage: test_dependence() without return types