I need to retrieve 2D-convolutional weights (and biases) from a state_dict.
The easiest thing it comes to my mind is iterating over the dictionary keys for 4d shaped Tensors whose name ends with .weight and then retrieve also their .bias counterpart.
This approach seems error prone to me, since I have not the guarantee that the .weight/.bias I retrieve come from a convolutional layer. I mean, the only guarantee I have is that it is 4d shaped.
Wouldn’t it be more practical to store keys like features.conv2d.0.weight, features.conv2d.1.weight, and so on?