import tensorflow as tf

        output = tf.concat([output_fw, output_bw], axis=-1)
    else:
        outputs = outputs_fw
        hidden = hidden_fw
        output = output_fw

    outputs = tf.transpose(outputs, perm=[1, 0, 2])
    return (outputs, hidden, output)
