import tensorflow as tf

        if mode != 'gen':
            neg_log_lhoods = tf.nn.sigmoid_cross_entropy_with_logits(logits=logits, labels=targets)
            if target_weight_strategy == 'rect':
                avg_neg_log_lhood = tf.reduce_mean(neg_log_lhoods)
            else:
                neg_log_lhoods = tf.multiply(neg_log_lhoods, target_weights)
                # be careful to have at least one weight be nonzero
                # should we be taking the mean elem-wise by batch? i think this is a big bug
                avg_neg_log_lhood = tf.reduce_sum(neg_log_lhoods) / tf.reduce_sum(target_weights)
            neg_log_lhoods_inspect = tf.reshape(neg_log_lhoods, [batch_size, rnn_nunroll])

        # Train op
        if mode == 'train':
            lr = tf.Variable(0.0, trainable=False)
            self._lr = lr
            self._lr_summary = tf.summary.scalar('learning_rate', self._lr)

            tvars = tf.trainable_variables()
