Add new layers(module) that parallel with classification module, and do back propagation


I’m a little confused about the nn.module creation. I am trying to do the transfer learning(domain adaptation) task which utilises the pre-trained model of VGG19. I know how to use the given VGG net module and change a single layer using model_list pop and add sequentially. However, If I want to add new layers(module) that parallel with classification module, which means that after feature module(pool5), instead of the original classification module branch(e.g. fc6, fc7) that with input of pool5, can I have another module that also take the output of pool5 as input to confirm other tasks, for instance, domain prediction? And if it is created, how can we do the backpropagation?

Any suggestion would be really appreciated! Thank you very much for the help!

you can construct a new model that has parts of the original VGG model and restore weights to the appropriate layers. that’s the best way forward.