You can return dicts in your forward method:
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.fc1 = nn.Linear(1, 1)
        self.fc2 = nn.Linear(1, 1)
        
    def forward(self, x):
        x1 = self.fc1(x)
        x2 = self.fc2(x)
        return {'x1': x1, 'x2': x2}

model = MyModel()
out_dict = model(torch.randn(1, 1))
print(out_dict)
> {'x1': tensor([[0.5168]], grad_fn=<AddmmBackward>), 'x2': tensor([[0.2288]], grad_fn=<AddmmBackward>)}