How to delete layer in pretrained model?

InceptionV3 uses functional calls in its forward, which will be missing, if you wrap all submodules in an nn.Sequential container.
In particular this flatten operation will be missing.

You could use forward hooks as described here.

2 Likes