import tensorflow as tf


    self.weights = tf.constant(weights, dtype=tf.float32, name='class_weights')

    hidden_size = model_params['model_hidden_size']
    proj_size = model_params['model_proj_size']  # optional, can be None

    def GetCell():
      """Creates an LSTM cell with dropout."""
      c = tf.nn.rnn_cell.LSTMCell(hidden_size,
                                  use_peepholes=model_params['peepholes'],
                                  num_proj=proj_size)
      if dropout_keep_prob is not None:
        c = tf.nn.rnn_cell.DropoutWrapper(c, input_keep_prob=dropout_keep_prob)
      return c

    # Create the bi-directional LSTM
    with tf.variable_scope('wordrnn'):
      with tf.variable_scope('fw'):
        cell_fw = GetCell()
      with tf.variable_scope('bw'):
        cell_bw = GetCell()

      rnnout, _, _ = tf.nn.bidirectional_rnn(cell_fw, cell_bw, self._inputs,
                                             dtype=tf.float32,
