Good day.
- How do I view the layers in a model such as
model = torch.hub.load(‘pytorch/vision:v0.10.0’, ‘resnet101’, pretrained=True)
- How would I add or change the final layer of this model?
Thanks.
Good day.
model = torch.hub.load(‘pytorch/vision:v0.10.0’, ‘resnet101’, pretrained=True)
Thanks.
You can directly print
the model to see all registered layers. Alternatively, you can also iterate the .modules()
.
In the previous step you will see the final layer definition as self.fc
and could replace it with your custom layer.
To add on to what patrick said, I have done this using add_module, not sure if it is the best way, however