#NEWLINE# def test_moments( self ) : #NEWLINE# #INDENT# '\n        Test moments computation in Take node\n        ' #NEWLINE# X = GaussianARD ( [ 1 , 2 ] , [ 1 , 0.5 ] , shape = ( ) ) #NEWLINE# Y = Take ( X , 1 ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , 2 ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , 6 ) #NEWLINE# X = GaussianARD ( [ 1 , 2 ] , [ 1 , 0.5 ] , shape = ( ) ) #NEWLINE# Y = Take ( X , [ 1 , 1 , 0 , 1 ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ 2 , 2 , 1 , 2 ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ 6 , 6 , 2 , 6 ] ) #NEWLINE# X = GaussianARD ( [ 1 , 2 ] , [ 1 , 0.5 ] , shape = ( ) ) #NEWLINE# Y = Take ( X , [ [ 1 , 1 , 0 ] , [ 1 , 0 , 1 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ [ 2 , 2 , 1 ] , [ 2 , 1 , 2 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ 6 , 6 , 2 ] , [ 6 , 2 , 6 ] ] ) #NEWLINE# X = GaussianARD ( [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] , [ [ 1 , ( 1 / 2 ) ] , [ ( 1 / 3 ) , ( 1 / 4 ) ] , [ ( 1 / 5 ) , ( 1 / 6 ) ] ] , shape = ( 2 , ) ) #NEWLINE# Y = Take ( X , 2 ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ 5 , 6 ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ ( 25 + 5 ) , 30 ] , [ 30 , ( 36 + 6 ) ] ] ) #NEWLINE# X = GaussianARD ( [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] , [ [ 1 , ( 1 / 2 ) ] , [ ( 1 / 3 ) , ( 1 / 4 ) ] , [ ( 1 / 5 ) , ( 1 / 6 ) ] ] , shape = ( 2 , ) ) #NEWLINE# Y = Take ( X , [ 1 , 1 , 0 , 2 ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ [ 3 , 4 ] , [ 3 , 4 ] , [ 1 , 2 ] , [ 5 , 6 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ [ ( 9 + 3 ) , 12 ] , [ 12 , ( 16 + 4 ) ] ] , [ [ ( 9 + 3 ) , 12 ] , [ 12 , ( 16 + 4 ) ] ] , [ [ ( 1 + 1 ) , 2 ] , [ 2 , ( 4 + 2 ) ] ] , [ [ ( 25 + 5 ) , 30 ] , [ 30 , ( 36 + 6 ) ] ] ] ) #NEWLINE# X = GaussianARD ( [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] , [ [ 1 , ( 1 / 2 ) ] , [ ( 1 / 3 ) , ( 1 / 4 ) ] , [ ( 1 / 5 ) , ( 1 / 6 ) ] ] , shape = ( 2 , ) ) #NEWLINE# Y = Take ( X , [ [ 1 , 1 ] , [ 0 , 2 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ [ [ 3 , 4 ] , [ 3 , 4 ] ] , [ [ 1 , 2 ] , [ 5 , 6 ] ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ [ [ ( 9 + 3 ) , 12 ] , [ 12 , ( 16 + 4 ) ] ] , [ [ ( 9 + 3 ) , 12 ] , [ 12 , ( 16 + 4 ) ] ] ] , [ [ [ ( 1 + 1 ) , 2 ] , [ 2 , ( 4 + 2 ) ] ] , [ [ ( 25 + 5 ) , 30 ] , [ 30 , ( 36 + 6 ) ] ] ] ] ) #NEWLINE# X = GaussianARD ( [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] , [ [ 1 , ( 1 / 2 ) ] , [ ( 1 / 3 ) , ( 1 / 4 ) ] , [ ( 1 / 5 ) , ( 1 / 6 ) ] ] , shape = ( ) ) #NEWLINE# Y = Take ( Y , [ 1 , 0 , 1 ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ [ 2 , 1 , 2 ] , [ 4 , 3 , 4 ] , [ 6 , 5 , 6 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ ( 4 + 2 ) , ( 1 + 1 ) , ( 4 + 2 ) ] , [ ( 16 + 4 ) , ( 9 + 3 ) , ( 16 + 4 ) ] , [ ( 36 + 6 ) , ( 25 + 5 ) , ( 36 + 6 ) ] ] ) #NEWLINE# X = GaussianARD ( [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] , [ [ 1 , ( 1 / 2 ) ] , [ ( 1 / 3 ) , ( 1 / 4 ) ] , [ ( 1 / 5 ) , ( 1 / 6 ) ] ] , shape = ( ) ) #NEWLINE# Y = Take ( X , [ 2 , 0 ] , plate_axis = ( - 2 ) ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ [ 5 , 6 ] , [ 1 , 2 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ ( 25 + 5 ) , ( 36 + 6 ) ] , [ ( 1 + 1 ) , ( 4 + 2 ) ] ] ) #NEWLINE# X = GaussianARD ( [ 1 , 2 ] , [ 1 , ( 1 / 2 ) ] , plates = ( 3 , ) , shape = ( 2 , ) ) #NEWLINE# Y = Take ( X , [ 1 , 1 , 0 , 1 ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 0 ] , [ [ 1 , 2 ] , [ 1 , 2 ] , [ 1 , 2 ] , [ 1 , 2 ] ] ) #NEWLINE# self . assertAllClose ( Y . get_moments ( ) [ 1 ] , [ [ [ ( 1 + 1 ) , 2 ] , [ 2 , ( 4 + 2 ) ] ] , [ [ ( 1 + 1 ) , 2 ] , [ 2 , ( 4 + 2 ) ] ] , [ [ ( 1 + 1 ) , 2 ] , [ 2 , ( 4 + 2 ) ] ] , [ [ ( 1 + 1 ) , 2 ] , [ 2 , ( 4 + 2 ) ] ] ] ) #NEWLINE# pass