What is difference between features and state_dict()


What is difference b/w
vgg1 = models.vgg16(pretrained=True).state_dict()

vgg2 = models.vgg16(pretrained=True).features

I have used features with Sequential and OrderedDict for transfer learning
but I haven’t used state_dict much
as far as I understood I believe state_dict() might be used to load weights and bias independently?

Any nn.Module subclasses’ state_dict method returns a dictionary with the named parameters and buffers. Useful for storing and loading (via load_state_dict). The state dict does not contain any information about how these parameters are used, these are provided by the model.

VGG.features is the “feature extractor” (the convolutional part) of the VGG model, a submodule.
So they are really quite different things for different purposes.

Best regards


Thanks I understood the difference