ptrblck:


You could just add the parameters lists:

optimizer = optim.SGD(list(modelA.parameters()) + list(modelB.parameters()), lr=1e-3)



This is so cool about pytorch. So simple.


How are you transferring the parameters from layer A2 to B1? If so, the weight matrix will have a size mismatch ( [30, 8] vs. [40, 8] ).


I have a method class that extract those activations and I will be using them as inputs for B1. I hope, but might be wrong, that I won’t encounter size mismatches! I will report back later about it.