'Construct the WaveNet network.'

def _create_network(self, input_batch, global_condition_batch):

    outputs = []
    current_layer = input_batch
    if self.scalar_input:
        initial_channels = 1
    else:
        initial_channels = self.quantization_channels
    current_layer = self._create_causal_layer(current_layer)
    output_width = ((tf.shape(input_batch)[1] - self.receptive_field) + 1)
    with tf.name_scope('dilated_stack'):
        for (layer_index, dilation) in enumerate(self.dilations):
            with tf.name_scope('layer{}'.format(layer_index)):
                (output, current_layer) = self._create_dilation_layer(current_layer, layer_index, dilation, global_condition_batch, output_width)
                outputs.append(output)
    with tf.name_scope('postprocessing'):
        w1 = self.variables['postprocessing']['postprocess1']
        w2 = self.variables['postprocessing']['postprocess2']
        if self.use_biases:
            b1 = self.variables['postprocessing']['postprocess1_bias']
            b2 = self.variables['postprocessing']['postprocess2_bias']
        if self.histograms:
            tf.histogram_summary('postprocess1_weights', w1)
            tf.histogram_summary('postprocess2_weights', w2)
            if self.use_biases:
                tf.histogram_summary('postprocess1_biases', b1)
                tf.histogram_summary('postprocess2_biases', b2)
        total = sum(outputs)
        transformed1 = tf.nn.relu(total)
        conv1 = tf.nn.conv1d(transformed1, w1, stride=1, padding='SAME')
        if self.use_biases:
            conv1 = tf.add(conv1, b1)
        transformed2 = tf.nn.relu(conv1)
        conv2 = tf.nn.conv1d(transformed2, w2, stride=1, padding='SAME')
        if self.use_biases:
            conv2 = tf.add(conv2, b2)
    return conv2
