def self_test():
 with tf.Session() as sess:
  print('Self-test for neural translation model.')
  model = seq2seq_model.Seq2SeqModel(10, 10, [(3, 3), (6, 6)], 32, 2, 5.0, 32, 0.3, 0.99, num_samples=8)
  sess.run(tf.global_variables_initializer())
  data_set = ([([1, 1], [2, 2]), ([3, 3], [4]), ([5], [6])], [([1, 1, 1, 1, 1], [2, 2, 2, 2, 2]), ([3, 3, 3], [5, 6])])
  for _ in xrange(5):
   bucket_id = random.choice([0, 1])
   (encoder_inputs, decoder_inputs, target_weights) = model.get_batch(data_set, bucket_id)
   model.step(sess, encoder_inputs, decoder_inputs, target_weights, bucket_id, False)

def self_test ( ) : with tf . Session ( ) as sess : print ( 'Self-test for neural translation model.' ) model = seq2seq_model . Seq2SeqModel ( 10 , 10 , [ ( 3 , 3 ) , ( 6 , 6 ) ] , 32 , 2 , 5.0 , 32 , 0.3 , 0.99 , num_samples = 8 ) sess . run ( tf . global_variables_initializer ( ) ) data_set = ( [ ( [ 1 , 1 ] , [ 2 , 2 ] ) , ( [ 3 , 3 ] , [ 4 ] ) , ( [ 5 ] , [ 6 ] ) ] , [ ( [ 1 , 1 , 1 , 1 , 1 ] , [ 2 , 2 , 2 , 2 , 2 ] ) , ( [ 3 , 3 , 3 ] , [ 5 , 6 ] ) ] ) for _ in xrange ( 5 ) : bucket_id = random . choice ( [ 0 , 1 ] ) ( encoder_inputs , decoder_inputs , target_weights ) = model . get_batch ( data_set , bucket_id ) model . step ( sess , encoder_inputs , decoder_inputs , target_weights , bucket_id , False )
test the translation model .