import tensorflow as tf

                    encoder_input_length_ = (encoder_input_length_ + stride - 1) // stride  # rounding up

            last_backward = encoder_outputs_[:, 0, cell_output_size:]
            indices = tf.stack([tf.range(batch_size), encoder_input_length_ - 1], axis=1)
            last_forward = tf.gather_nd(encoder_outputs_[:, :, :cell_output_size], indices)
            last_forward.set_shape([None, cell_output_size])

            if encoder.final_state == 'concat_last': # concats last states of all backward layers (full LSTM states)
