Loading state_dict from two pre-trained models

I have a network with two different branches (each branch is for a different modality). I pre-trained each branch individually and now i want to train the full network and initialize the weights from my pre-trained models.
will it work if i just do:


or will the second load “override” the first one somehow (assume the layer names in the two branches are different and unique)


If the layers names are unique it should work. You can check it by initializing all the values to zero at the beginning and then see the values of the weights after each line.