import tensorflow as tf

        # Residual connection:
        highway_input = proj2_output + inputs

        half_depth = depth // 2
        assert half_depth * 2 == depth, 'encoder and postnet depths must be even.'

        # Handle dimensionality mismatch:
        if highway_input.shape[2] != half_depth:
            highway_input = tf.layers.dense(highway_input, half_depth)

        # 4-layer HighwayNet:
        for i in range(4):
            highway_input = highwaynet(highway_input, 'highway_%d' % (i + 1), half_depth)
        rnn_input = highway_input

        # Bidirectional RNN
