you can define a nn.module class, then change it in forward, for example
class net(nn.Module):
    def__init__(self):
        super(net, self).__init__()
        self.fc1 = nn.Linear(W_target.size(0), 1)
        self.fc2 = nn.Linear(W_target.size(0), 1)

   def forward(self, x):
        x1 = self.fc1(x)
        y = make_features(x1)
        y_pred = self.fc2(y)
        return y_pred