def build_multiscale_classifier(self, input_size):
        n, c, h, w = input_size
        hidden_shapes = []
        for i in range(self.n_scale):
            if i < self.n_scale - 1:
                c *= 2 if self.factor_out else 4
                h //= 2
                w //= 2
            hidden_shapes.append((n, c, h, w))

        classification_heads = []
        for i, hshape in enumerate(hidden_shapes):
            classification_heads.append(
                nn.Sequential(
                    nn.Conv2d(hshape[1], self.classification_hdim, 3, 1, 1),
                    layers.ActNorm2d(self.classification_hdim),
                    nn.ReLU(inplace=True),
                    nn.AdaptiveAvgPool2d((1, 1)),
                ))
        self.classification_heads = nn.ModuleList(classification_heads)
        self.logit_layer = nn.Linear(
            self.classification_hdim * len(classification_heads),
            self.n_classes)
 def _actnorm(size, fc):
     if fc:
         return FCWrapper(layers.ActNorm1d(size[0] * size[1] * size[2]))
     else:
         return layers.ActNorm2d(size[0])