Thanks, @ptrblck for the reply. My main concern is how to make joint model M so that model knows about all the M1, M2etc.
I tried M=a1M1.parameters()+a2M2.parameters()
But now model M does not know about M1 and M2.
Here my objective is using a convex combination of a1 and a2 to learn a joint model that minimize the loss.
Thanks