def test_merge_with_weird_eq():
 x = T.constant(numpy.asarray(1), name='x')
 y = T.constant(numpy.asarray(1), name='y')
 g = Env([x, y], [(x + y)])
 MergeOptimizer().optimize(g)
 assert (len(g.apply_nodes) == 1)
 node = list(g.apply_nodes)[0]
 assert (len(node.inputs) == 2)
 assert (node.inputs[0] is node.inputs[1])
 x = T.constant(numpy.ones(5), name='x')
 y = T.constant(numpy.ones(5), name='y')
 g = Env([x, y], [(x + y)])
 MergeOptimizer().optimize(g)
 assert (len(g.apply_nodes) == 1)
 node = list(g.apply_nodes)[0]
 assert (len(node.inputs) == 2)
 assert (node.inputs[0] is node.inputs[1])

def test_merge_with_weird_eq ( ) : x = T . constant ( numpy . asarray ( 1 ) , name = 'x' ) y = T . constant ( numpy . asarray ( 1 ) , name = 'y' ) g = Env ( [ x , y ] , [ ( x + y ) ] ) MergeOptimizer ( ) . optimize ( g ) assert ( len ( g . apply_nodes ) == 1 ) node = list ( g . apply_nodes ) [ 0 ] assert ( len ( node . inputs ) == 2 ) assert ( node . inputs [ 0 ] is node . inputs [ 1 ] ) x = T . constant ( numpy . ones ( 5 ) , name = 'x' ) y = T . constant ( numpy . ones ( 5 ) , name = 'y' ) g = Env ( [ x , y ] , [ ( x + y ) ] ) MergeOptimizer ( ) . optimize ( g ) assert ( len ( g . apply_nodes ) == 1 ) node = list ( g . apply_nodes ) [ 0 ] assert ( len ( node . inputs ) == 2 ) assert ( node . inputs [ 0 ] is node . inputs [ 1 ] )
numpy arrays dont compare equal like other python objects .