def build_network(self, network, extra, phase_test, global_step):
        info = selfsup.info.create(scale_summary=True)

        if self._size == 3:
            z = network['activations']['pool5']
        else:
            z = network['activations']['top']

        #z = tf.squeeze(z, [1, 2])
        z = tf.reshape(z, (z.get_shape().as_list()[0], -1))

        if self._use_scalers:
            z = selfsup.ops.scale(z, name='scale')

        #W_init = tf.contrib.layers.variance_scaling_initializer()
        W_init = tf.random_normal_initializer(0.0, 0.0001)
        b_init = tf.constant_initializer(0.0)

        reduce_ch = self._reduce_channels

        with tf.variable_scope('reduction'):
            c_o = reduce_ch
            reduce_W = tf.get_variable('weights', [z.get_shape().as_list()[1], c_o], dtype=tf.float32,
                                initializer=W_init)
            reduce_b = tf.get_variable('biases', [c_o], dtype=tf.float32,
                                initializer=b_init)
        z = tf.nn.xw_plus_b(z, reduce_W, reduce_b)
        z = tf.nn.relu(z)

        z = tf.reshape(z, [self._loader.batch_size, -1, z.get_shape().as_list()[-1]])
        z = tf.concat(tf.unstack(z, axis=1), 1)

        with tf.variable_scope('jigsaw'):
            c_o = len(self._permutations)
            jigsaw_W = tf.get_variable('weights', [z.get_shape().as_list()[1], c_o], dtype=tf.float32,
                                initializer=W_init)
            jigsaw_b = tf.get_variable('biases', [c_o], dtype=tf.float32,
                                initializer=b_init)
        z = tf.nn.xw_plus_b(z, jigsaw_W, jigsaw_b)

        with tf.variable_scope('primary_loss'):
            loss_each = tf.nn.sparse_softmax_cross_entropy_with_logits(labels=self._y, logits=z)
            primary_loss = tf.reduce_mean(loss_each)

        with tf.name_scope('weight_decay'):
            wd = 1e-6
            l2_loss = tf.nn.l2_loss(reduce_W) + tf.nn.l2_loss(jigsaw_W)
            weight_decay = wd * l2_loss

        with tf.name_scope('loss'):
            loss = weight_decay + primary_loss

        variables = info['vars']

        self.losses = OrderedDict([
            ('main', primary_loss),
            ('+weight_decay', weight_decay),
        ])
        self.primary_loss = primary_loss
        self.loss = loss
        self.feedback_variables = []

        info['activations']['primary_loss'] = primary_loss
        info['activations']['loss'] = loss
        info['activations']['weight_decay'] = weight_decay
        return info