Suppose that I have two model M1 and M2. I want to make a joint model M=a1M1+a2M2, later I want to calculate the gradient of M wrt a1 and a2 (i.e. wrt combination weight).
Could anyone suggest how to do that?
Thanks