text: from framework import Framework
  import tensorflow as tf
  
  FLAGS = tf.app.flags.FLAGS
  
  
  def rnn_max_adv(is_training):
      if is_training:
          with tf.variable_scope('rnn_max_adv', reuse=False):
              framework = Framework(is_training=True)
              word_embedding = framework.embedding.word_embedding()
              pos_embedding = framework.embedding.pos_embedding()
              embedding = framework.embedding.concat_embedding(word_embedding, pos_embedding)
              x = framework.encoder.rnn(embedding, FLAGS.hidden_size, framework.length)
              logit, repre = framework.selector.maximum(x, framework.scope, framework.label_for_select)
  
          # Add perturbation
          loss = framework.classifier.softmax_cross_entropy(logit)
          new_word_embedding = framework.adversarial(loss, word_embedding)
          new_embedding = framework.embedding.concat_embedding(new_word_embedding, pos_embedding)
  
          # Train
          with tf.variable_scope('rnn_max_adv', reuse=True):
              x = framework.encoder.rnn(new_embedding, FLAGS.hidden_size, framework.length)
              logit, repre = framework.selector.maximum(x, framework.scope, framework.label_for_select)
              loss = framework.classifier.softmax_cross_entropy(logit)
              output = output(logit)
          framework.init_train_model(loss, output, optimizer=tf.train.GradientDescentOptimizer)
          framework.load_train_data()
          framework.train()
      else:
          with tf.variable_scope('rnn_max_adv', reuse=False):
              framework = Framework(is_training=False)
              word_embedding = framework.embedding.word_embedding()
              pos_embedding = framework.embedding.pos_embedding()
              embedding = framework.embedding.concat_embedding(word_embedding, pos_embedding)
              x = framework.encoder.rnn(embedding, FLAGS.hidden_size, framework.length)
              logit, repre = framework.selector.maximum(x, framework.scope, framework.label_for_select)
  
          framework.init_test_model(logit)
          framework.load_test_data()
          framework.test()
  