There’re already many resnet in torchvision , you can use it out of the box. just do the following
from torchvision import models
resnet50 = models.resnet50(pretrained=True)
resnet18 = models.resnet18(pretrained=True)