import tensorflow as tf


    return losses, [outputs], encoder_state, attention_states, attention_weights, samples, beam_fun, initial_data


def reconstruction_encoder_decoder(encoders, decoders, encoder_inputs, targets, feed_previous,
                                   encoder_input_length=None, training=True, reconstruction_weight=1.0,
                                   reconstruction_attn_weight=0.05, **kwargs):
    encoders = encoders[:1]

    if encoder_input_length is None:
        weights = get_weights(encoder_inputs[0], utils.EOS_ID, include_first_eos=True)
        encoder_input_length = [tf.to_int32(tf.reduce_sum(weights, axis=1))]

    attention_states, encoder_state, encoder_input_length = multi_encoder(
        encoder_input_length=encoder_input_length, encoders=encoders, encoder_inputs=encoder_inputs,
        training=training)

    outputs, attention_weights, states, _, samples, beam_fun, initial_data = attention_decoder(
        attention_states=attention_states, initial_state=encoder_state, feed_previous=feed_previous,
        decoder_inputs=targets[0][:, :-1], encoder_input_length=encoder_input_length,
        decoder=decoders[0], training=training, encoders=encoders
    )
