Skip Connections and Sequential model

Hi, I’m trying to use parts of a UNet architecture.

I created a UNet(nn.Module) class, with attributes conv1 conv2, and so on.

So when I say unet.children(), I get the layers.

I want to use a pre-trained UNet to get features out. So I tried casting this into a sequential model so that I could get features at an arbitrary layer, but ran into the problem of skip connections.

Any insight on how to wrap them into a Sequential model?

UNet is not a sequential model thus you can’t do it purely in a sequential model. You could hold the model in a nn.ModuleList and then do the skip connections manually.