I have two models(model1 and model2) running in coupled manner
output1 = model1(input)
output2 = model2(input)
loss1= loss_fn(output1)
loss2= loss_fn(output2)
loss = min(loss1, loss2)

How do I propogate this loss to both model1 and model2 ?
NOTE: I understand
loss = loss1 + loss2
loss.backward()

the above could work but I need the min(loss1, loss2) to be back prop to both models.