#NEWLINE# def test_recurrent_layers( self ) : #NEWLINE# #INDENT# X = [ [ 1 , 3 , 5 , 7 ] , [ 2 , 4 , 8 , 10 ] , [ 1 , 5 , 9 , 11 ] , [ 2 , 6 , 8 , 0 ] ] #NEWLINE# Y = [ [ 0.0 , 1.0 ] , [ 1.0 , 0.0 ] , [ 0.0 , 1.0 ] , [ 1.0 , 0.0 ] ] #NEWLINE# with tf . Graph ( ) . as_default ( ) : #NEWLINE# #INDENT# g = tflearn . input_data ( shape = [ None , 4 ] ) #NEWLINE# g = tflearn . embedding ( g , input_dim = 12 , output_dim = 4 ) #NEWLINE# g = tflearn . lstm ( g , 6 ) #NEWLINE# g = tflearn . fully_connected ( g , 2 , activation = 'softmax' ) #NEWLINE# g = tflearn . regression ( g , optimizer = 'sgd' , learning_rate = 1.0 ) #NEWLINE# m = tflearn . DNN ( g ) #NEWLINE# m . fit ( X , Y , n_epoch = 500 , snapshot_epoch = False ) #NEWLINE# self . assertGreater ( m . predict ( [ [ 5 , 9 , 11 , 1 ] ] ) [ 0 ] [ 1 ] , 0.9 )