Hello All;
I already have a trained model that has several convolution blocks (conv + relu + pooling), which is saved and loaded.
Here it is:

image1098×1092 71.3 KB

Here’s what I’m trying to do:

I want to be able, to reuse only a chunk of my model, let’s say inputting at Conv2d-5 and outputting at the last Linear-19, or inputting at BatchNorm2d-11 and outputting at the last layer still Linear-19.
The target is to be able to choose any intermediate layer, and give it a tensor as input w.r.t the layer input dimension, and outputting with the last layer.

I wanted to use nn.ModuleList() and append from mymodel’s layers, but mymodel.state_dict().items() doesn’t print my pooling layers.
I’ve tried also mymodel._modules.keys(), it’s viewing the pooling layer, but not in the order they are called in my Neural Network.
See:

image2178×172 27 KB

Thank you very much for your help,
Habib