Check the implementation of ResNet50 from torchvision and implement custom network something like:
class ModifiedResNet50(nn.Module):
    def __init__(self,):
         pass
    def forward(input):
         pass

Then load weights from pretrained ResNet50 like given below:
vanilla_resnet = models.resnet50(pretrained=True)
modified_resnet = ModifiedResNet50()

for k,v in modified_resnet.state_dict():
    if k in vanilla_resnet.state_dict():
        modified_resnet.state_dict[k] = vanilla_resnet.state_dict[k]