I am curious about the layer naming (key values of state_dict) of the vgg16 pretrained model from torchvision.models module, e.g.: ‘features.0.weight’, ‘features.0.bias’, ‘features.2.weight’, ‘features.2.bias’, etc. The number increases by 2 with each new convolutional or fc layer, and increases by 3 each time encountering a max pooling layer.
The numbered indices in these modules names are created by the nn.Sequential module.
Layers without any parameters will still get the index, but won’t be shown in the state_dict.
Here is a small example: