Hi,



 111148:

Exactly I do not want to initialize the last layer.


What do you mean by not initializing the last layer? How this would be different from transfer learning?
You can do like this:
class SubNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.net = Network()
        self.last_linear = nn.Linear(2,1)
    def forward(self, x):
        y1, y2 = self.net(x)
        return y1, y2, self.last_linear(y2)