Modify Inception_v3 to get multiple outputs

This is my code

class MyModel(nn.Module):
    def __init__(self, num_classes1, num_classes2):
        super(MyModel, self).__init__()
        self.model_inception = models.inception_v3(pretrained=True)
        num_ftrs = self.model_inception.AuxLogits.fc.in_features
        self.model_inception.fc = nn.Sequential()
        self.fc1 = nn.Linear(num_ftrs, num_classes1)
        self.fc2 = nn.Linear(num_ftrs, num_classes2)

    def forward(self, x):
        x = self.model_inception(x)
        out1 = self.fc1(x)
        out2 = self.fc2(x)
        return out1, out2

But i am getting the following error
AttributeError: ‘tuple’ object has no attribute ‘dim’

Can you share the line of code on which you are getting that error? (or the complete error message)

The inception_v3 model returns two outputs in the default setting: the output from the last layer and an auxiliary output.
If you don’t want to use the aux_output, just pass the last output to self.fc1:

x = self.model_inception(x)
out1 = self.fc1(x[0])
out2 = self.fc2(x[0])

Thanks peter again!!