Which one is correct to initialize separate layer?

I have a network likes

x-->fc1(x)-->outputx
y-->fc2(y)-->outputy

So, when I define the network, can I used the same name for fc1 and fc2 likes

class network(nn.Module):    
    def __init__(self):
       self.fc = nn.Linear(1,2)
   def forward(x,y)
      output1= self.fc(x)
      output2 = self.fc(y)

Or I have to seperate into two layer such as

class network(nn.Module):    
    def __init__(self):
       self.fc1 = nn.Linear(1,2)
       self.fc2 = nn.Linear(1,2)
   def forward(x,y)
      output1= self.fc1(x)
      output2 = self.fc2(y)

Thanks

Both models define valid forward methods (besides the missing return statement) and it depends on your use case, which one is correct.
If you would like to apply the same parameters for both inputs (weight sharing), the first definition is correct, while the second model will use two different layers and parameter sets.

Based on the first pseudo code, it seems you would like to use two separate layers, so the second model definition should be right.