#NEWLINE# def test_iterative_max_product_chain( ) : #NEWLINE# #INDENT# rnd = np . random . RandomState ( 0 ) #NEWLINE# chain = np . c_ [ ( np . arange ( 9 ) , np . arange ( 1 , 10 ) ) ] #NEWLINE# for i in range ( 10 ) : #NEWLINE# #INDENT# unary_potentials = rnd . normal ( size = ( 10 , 3 ) ) #NEWLINE# pairwise_potentials = rnd . normal ( size = ( 9 , 3 , 3 ) ) #NEWLINE# result_ad3 = inference_ad3 ( unary_potentials , pairwise_potentials , chain , branch_and_bound = True ) #NEWLINE# result_mp = iterative_max_product ( unary_potentials , pairwise_potentials , chain ) #NEWLINE# assert_array_equal ( result_ad3 , result_mp )