Feature extraction in torchvision.models.vit_b_16

Wrapping the submodules into an nn.Sequential container works for models which only use nn.Modules and no functional API calls and initialize them in a sequential manner.
In your use case you would lose all functional calls used in the original forward method as seen here.

1 Like