import tensorflow as tf


    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)

    if encoder.mult_attn:
