I am trying to edit forward function of some pretrained model (f.e. resnet50 or senet154) from pretrainedmodels library by adding additional input parameter.
What do u think about solution like this:
class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.net = pretrainedmodels.__dict__["model_name"](pretrained=True) self.fc1 = nn.Linear(x_dim+y_dim, output_size_like_in_last_linear) def forward(self, x, y): x1 = self.net(x) x2 = y. x = torch.cat((x1, x2), dim=1) x = F.relu(self.fc1(x)) return x
Do you think it will work proper? Do you have any suggestions?
What I want to do is to consider parameter y in the last layer of the pretrained model.