How to use ResNet50_Weights from torchvision on an MLP model?

I have this idea where I want to use resnet weights ResNet50_Weights from torchvision to my custom MLP model. I am not very sure whether this make sense or if its possible. Is it possible to initialize the weights of my MLP model with ResNet50_Weights? I am asking here because there is no clue online on how to do this.

Any insight is welcome. Thank you in advance

You can certainly load parameters from one model to another one assuming their shape matches.
In your use case you might be able to load some linear layer parameters, but would need to make sure these layers were initialized with the same in and out features.

1 Like