import tensorflow as tf

                last_layer_size = layer_size
                print('{}: {}'.format(layer_name, last_layer.get_shape()))

                export_feat_tensors[layer_name] = last_layer

            dnn_output = last_layer
            dnn_output_size = last_layer_size

        # Logistic regression
        with tf.variable_scope('logit') as scope:
            logit_w = tf.get_variable('W', shape=[dnn_output_size, 1], initializer=tf.truncated_normal_initializer(stddev=1.0 / dnn_output_size, dtype=dtype), dtype=dtype)
            logit_b = tf.get_variable('b', shape=[1], initializer=tf.constant_initializer(0.0), dtype=dtype)
        logits = tf.squeeze(tf.nn.bias_add(tf.matmul(dnn_output, logit_w), logit_b), squeeze_dims=[1])
        prediction = tf.nn.sigmoid(logits)
        prediction_inspect = tf.reshape(prediction, [batch_size, rnn_nunroll])
        prediction_final = tf.squeeze(tf.slice(prediction_inspect, [0, rnn_nunroll - 1], [-1, 1]), squeeze_dims=[1])
        print('logit: {}'.format(logits.get_shape()))

        # Compute loss
        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:
