Problem
Inspired by the architecture of Inception (where there are auxiliary branches in the middle of the entire network), I would like to try to add auxiliary branches to each block in ResNet, namely model.layer1 through model.layer4 in model = resnet18(pretrianed=True).
As much as I could easily replace model.fc with the layer I defined below and achieves the multi-task learning, it seems that there is no easy way to replace model.layer1 … model.layer4 without changing the original model definition.
class MultiTaskBranch(nn.Module):
    def __init__(self, input_size, num_classes):
        super(MultiTaskBranch, self).__init__()

        self.multi_task_classifier = nn.Sequential(nn.Linear(input_size, 100),
                                                   nn.BatchNorm1d(num_features=100),
                                                   nn.LeakyReLU(inplace=True),
                                                   nn.Linear(100, num_classes))
        self.classifier = nn.Sequential(nn.Linear(input_size, 100),
                                        nn.BatchNorm1d(num_features=100),
                                        nn.LeakyReLU(inplace=True),
                                        nn.Linear(100, num_classes))
    def forward(self, x):
        return self.classifier(x), self.multi_task_classifier(x)

So my question is

Is it possible to meet this purpose without changing the original architecture (maybe something like hook?).
If it is not possible and I decide to change the original architecture, is it possible to still use the pretrained weights?

Could someone help me, thank you in advance!