import tensorflow as tf


    encoder_state = tf.concat(encoder_states, 1)
    return encoder_outputs, encoder_state, new_encoder_input_length


def compute_energy(hidden, state, encoder, time=None, input_length=None, prev_weights=None, **kwargs):
    batch_size = tf.shape(hidden)[0]
    time_steps = tf.shape(hidden)[1]

    if encoder.attn_keep_prob is not None:
        state_noise_shape = [1, tf.shape(state)[1]] if encoder.pervasive_dropout else None
        state = tf.nn.dropout(state, keep_prob=encoder.attn_keep_prob, noise_shape=state_noise_shape)
        hidden_noise_shape = [1, 1, tf.shape(hidden)[2]] if encoder.pervasive_dropout else None
        hidden = tf.nn.dropout(hidden, keep_prob=encoder.attn_keep_prob, noise_shape=hidden_noise_shape)
