I am trying to modify the resnet50 to give multiple outputs .However I am getting a Dimension Mismatch Error
This is my code
class ResNet(nn.Module):
    def __init__(self):
        super(ResNet, self).__init__()
        resnet = models.resnet50(pretrained=True)
        modules = list(resnet.children())[:-1]
        self.resnet = nn.Sequential(*modules)
        self.fc=nn.Linear(2048,10)

    def forward(self, x):

        x1 = self.resnet(x)  
        x1=self.fc(x1)
        x1 = x1.view(x1.size(0), -1)  
        
        x2 = self.resnet(x) 
        x2=self.fc(x2)
        x2= x2.view(x2.size(0), -1)
       
        
        return x1,x2


Capture.PNG896×226 24.2 KB