Seriously, does no one know  how to do this?
I want to use loss1 to update model.encoder and model.cls1, which is simple. I can just use loss1.backward().
But for loss2 and loss3 the situation is different. loss2 and loss3 is computed on the exact same computational graph. Yet I want loss2 only update model.cls2 and loss3 only update model.encoder.
Can I do that in an elegant way?