I wanted to make a function that take any torchvision model as argument and output the same model with a different output size, but I realized that a simple but annoying problem prevented me from directly doing so : The prediction layers of those models have different names. For example, the last layer of Resnet and Inception is called “fc”, while the last layer of AlexNet and VGG is called “classifier”.
I bypassed this problem by using hasattr(model, "fc")
, but it seems a bit odd to me.
Is there a reason for this difference ? Wouldn’t be better to just have one name ?