Can we get two outputs from pretrained ResNet? I mean adding two parallel linear layers at the end and getting outputs from them? I added a linear layer at the last layer of ResNet,
Net = torchvision.models.resnet18(pretrained=True)
num_ftrs = Net.fc.in_features
Net.fc = nn.Sequential( nn.Linear(num_ftrs, 10))
but how can I get two outputs from two parallel linear layer at the end? By using getattr https://discuss.pytorch.org/t/add-multiple-fc-layers-in-parallel/19008/13?
clf_outputs = {}
for i in range(self.num_fcs):
clf_outputs["fc%d" %i] = getattr(self, "fc%d" %i)(f)
how can this should be changed in pretrained case?