def test_sort_apply_nodes(): x = tensor.matrix('x') y = tensor.dot(x * 2, x + 1) str_cmp = lambda a, b: cmp(str(a), str(b)) # lexicographical sort nodes = sort_apply_nodes([x], [y], cmps=[str_cmp]) for a, b in zip(nodes[:-1], nodes[1:]): assert str(a) <= str(b)
def test_sort_apply_nodes(): x = tensor.matrix("x") y = tensor.dot(x * 2, x + 1) def str_cmp(a, b): return cmp(str(a), str(b)) # lexicographical sort nodes = sort_apply_nodes([x], [y], cmps=[str_cmp]) for a, b in zip(nodes[:-1], nodes[1:]): assert str(a) <= str(b)