You can just pass a flag into your model’s forward to chose a certain path:
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.path1 = nn.Linear(5, 10)
        self.path2 = nn.Linear(10, 10)
        
    def forward(self, x, path):
        if path == 'path1':
            x = self.path1(x)
        elif path == 'path2':
            x = self.path2(x)
        else:
            print('unknown path')
        return x

model = MyModel()
x1 = torch.randn(1, 5)
output1 = model(x1, 'path1')
x2 = torch.randn(1, 10)
output2 = model(x2, 'path2')