The residual connections won’t be destroyed, as they are implemented in the BasicBlock
and Bottleneck
layers. However, while wrapping the model in an nn.Sequential
container might work for your use case, I would recommend to use forward hooks and return the desired activation.
Here is an example of how to use forward hooks.