Solved by ptrblck in post #2 
              
              
                Yes, it should work as long as you don’t change the output type. In your case you could return an empty tensor in the if path as seen here: 
class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(1, 10)
        self.fc2 = nn.Linear(1, 2)
        sel…