if not add_extra:
        # Output (14,14) -> (5, 5)

        # the HiddenLayer being fully-connected, it operates on 2D matrices of
        # shape (batch_size,num_pixels) (i.e matrix of rasterized images).
        # This will generate a matrix of shape (20, 32 * 4 * 4) = (20, 512)
        layer2_input = layer1.output.flatten(2)

        # construct a fully-connected sigmoidal layer
        layer2 = HiddenLayer(rng, input=layer2_input,
                            n_in=50 * ((l1ims-4)/2)**2, n_out=500,
                            activation=T.tanh)

        # classify the values of the fully-connected sigmoidal layer
        layer3 = LogisticRegression(input=layer2.output, n_in=500, n_out=2)

    else:
        # Output (14,14) -> (5, 5)

        # the HiddenLayer being fully-connected, it operates on 2D matrices of
        # shape (batch_size,num_pixels) (i.e matrix of rasterized images).
        # This will generate a matrix of shape (20, 32 * 4 * 4) = (20, 512)
        layer2_input = T.horizontal_stack(layer1.output.flatten(2), x_extra)

        # construct a fully-connected sigmoidal layer
        layer2 = HiddenLayer(rng, input=layer2_input,
                            n_in=50 * ((l1ims-4)/2)**2 + ExtraColumns, n_out=500,
                            activation=T.tanh)

        # classify the values of the fully-connected sigmoidal layer
    if not add_extra:
        # Output (14,14) -> (5, 5)

        # the HiddenLayer being fully-connected, it operates on 2D matrices of
        # shape (batch_size,num_pixels) (i.e matrix of rasterized images).
        # This will generate a matrix of shape (20, 32 * 4 * 4) = (20, 512)
        layer2_input = layer1.output.flatten(2)

        # construct a fully-connected sigmoidal layer
        layer2 = HiddenLayer(rng, input=layer2_input,
                            n_in=50 * ((l1ims-4)/2)**2, n_out=50,
                            activation=T.tanh)

        # classify the values of the fully-connected sigmoidal layer
        layer3 = LogisticRegression(input=layer2.output, n_in=50, n_out=2)

    else:
        # Output (14,14) -> (5, 5)

        # the HiddenLayer being fully-connected, it operates on 2D matrices of
        # shape (batch_size,num_pixels) (i.e matrix of rasterized images).
        # This will generate a matrix of shape (20, 32 * 4 * 4) = (20, 512)
        layer2_input = T.horizontal_stack(layer1.output.flatten(2), x_extra)

        # construct a fully-connected sigmoidal layer
        layer2 = HiddenLayer(rng, input=layer2_input,
                            n_in=50 * ((l1ims-4)/2)**2 + ExtraColumns, n_out=500,
                            activation=T.tanh)

        # classify the values of the fully-connected sigmoidal layer