import tensorflow as tf

            layer2, weights2 = new_conv_layer(input=layer1, name="conv2", num_input_channels=64, num_filters=64, filter_size=5,
                                    ac_fun=tf.nn.relu, pool_ksize=[1, 3, 3, 1])
        with tf.name_scope('flatten'):
            layer3, num_features = flatten_layer(layer2)
        # fully connected layers
        with tf.variable_scope('fc1'):
            layer4, weights4 = new_fc_layer(input=layer3, name="fc1", num_inputs=num_features, num_outputs=fc_size1)
        # print(layer4)
        with tf.variable_scope('fc2'):
            logits, weights5 = new_fc_layer(input=layer4, name="fc2", num_inputs=fc_size1, num_outputs=fc_size2)

        # add histograms
        if not reuse:
            tf.histogram_summary(weights1.name, weights1)
            tf.histogram_summary(weights2.name, weights2)

        return logits


    def loss(self, channel_1, channel_2, label, margin):
        """
        Defines the contrastive loss. This loss ties the outputs of
        the branches to compute the following:

               L =  Y * d^2 + (1-Y) * max(margin - d^2, 0)

               where d is the L2 distance between the given
               input pair s.t. d = ||x_1 - x_2||_2 and Y is
