Is this neural net with two outputs still one neural network?

I’d like multiple outputs from a neural network from different inputs. I think I might have it below, but I’m not sure it is what I need.
What I need is for “net1” and “net2” to be aware of each other. Is this possible? Is this what is happening? See, I have a system I want a neural network to control. When net2 is taking an input and giving an output I need it to be affected by the training that happened to net1.


class Network(nn.Module):
    def __init__(self):
        super().__init__()
        
        self.net1 = nn.Sequential(
            nn.Linear(3, 5),
            nn.ReLU(),
            nn.Linear(5, 80),
            nn.ReLU(),
            nn.Linear(80, 40),
            nn.ReLU(),
            nn.Linear(40, 16),
            nn.ReLU(),
            nn.Linear(16, 2))  
        
        self.net2 = nn.Sequential(
            nn.Linear(3, 5),
            nn.ReLU(),
            nn.Linear(5, 80),
            nn.ReLU(),
            nn.Linear(80, 40),
            nn.ReLU(),
            nn.Linear(40, 16),
            nn.ReLU(),
            nn.Linear(16, 4))
        
    def forward(self, x):
        return self.net1(x), self.net2(x)

No, net1 and net2 do not share anything and are independently executed.
Updating or using one model won’t influence the other one in any way.

1 Like

What if I want two outputs from one neural network where…
One of the outputs is a bool, in other words, just an argmax from two values,
And the other is a value between 0 and 1000, which will come from an argmax with a thousand values.

Would you just give the neural net an output of 1002? Does this suffice? Does this make sense what I’m asking? Do the 1000 outputs totally outweigh the 2 outputs? Should I make the output for the bool 100 or also 1000 outputs in order to balance the network? To make sure the network knows the bool is just as important as the value between 0 and 1000?
Does the network understand the “weight” of the bool outputs, which are 0.2% of the network?

I assume you want to use argmax to get the predictions but not to calculate the losses, since argmax is not differentiable.

I don’t if creating a single output (assuming from a single model) or different outputs (assuming from different models) would work better. If you are using a single model and the outputs have large differences in their range, I would be concerned about the loss calculation as the larger loss could “mask” the smaller one.