Zzpl_bolts.models.self_supervised.resnets.resnet18 does not use the last fully connected layer

am trying to train a supervised classification model using pl_bolts. I am using the resnet18 model supplied with pl_bolts. Even if doing print(model) returns

...
 (1): BasicBlock(
        (conv1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (relu): ReLU(inplace=True)
        (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
    )
    (avgpool): AdaptiveAvgPool2d(output_size=(1, 1))
    (fc): Linear(in_features=512, out_features=2, bias=True)
  )
  (criteria): BCELoss()
)

doing model.forward(input).size() returns [batch_size, 512]. Diving into the resnet implementation (from here lightning-bolts/resnets.py at 8b4d90d7443ac263fd246e2745c267439f4b9274 · Lightning-AI/lightning-bolts · GitHub), the forward method looks like this :

    def forward(self, x):
        x0 = self.conv1(x)
        x0 = self.bn1(x0)
        x0 = self.relu(x0)
        x0 = self.maxpool(x0)

        if self.return_all_feature_maps:
            x1 = self.layer1(x0)
            x2 = self.layer2(x1)
            x3 = self.layer3(x2)
            x4 = self.layer4(x3)

            return [x0, x1, x2, x3, x4]
        else:
            x0 = self.layer1(x0)
            x0 = self.layer2(x0)
            x0 = self.layer3(x0)
            x0 = self.layer4(x0)

            x0 = self.avgpool(x0)
            x0 = torch.flatten(x0, 1)

            return [x0]

it does not use the fully connected layer declared at line 196. Is there a precise reason for this ? Is this because the model is intended for use in self-supervised learning and not classification ?

Hello, my apology for the late reply. We are slowly converging to deprecate this forum in favor of the GH build-in version… Could we kindly ask you to recreate your question there - Lightning Discussions