How can I get the output at the 2nd block of a resnet i.e. the layer that puts out a tensor with 128 channels?
The code below converts the model into a list then uses torch.nn.Sequential which destroys the residual connections in the resnet.
        self.encoder = models.resnet18(pretrained=True)
        modules = list(self.encoder.children())
        self.encoder = torch.nn.Sequential(*(list(modules)[:-4]))