import tensorflow as tf

    encoder_outputs = []
    new_encoder_input_length = []

    for i, encoder in enumerate(encoders):

        # create embeddings in the global scope (allows sharing between encoder and decoder)
        weight_scale = encoder.embedding_weight_scale or encoder.weight_scale
        if weight_scale is None:
            initializer = None   # FIXME
        elif encoder.embedding_initializer == 'uniform' or (encoder.embedding_initializer is None
                                                            and encoder.initializer == 'uniform'):
            initializer = tf.random_uniform_initializer(minval=-weight_scale, maxval=weight_scale)
        else:
            initializer = tf.random_normal_initializer(stddev=weight_scale)

        with tf.device('/cpu:0'):  # embeddings can take a very large amount of memory, so
            # storing them in GPU memory can be impractical
            if encoder.binary:
                embeddings = None  # inputs are token ids, which need to be mapped to vectors (embeddings)
            else:
                embedding_shape = [encoder.vocab_size, encoder.embedding_size]
                embeddings = get_variable('embedding_{}'.format(encoder.name), shape=embedding_shape,
