import torch.nn as nn
import torchvision.models as models

class resnet(nn.Module):
    def __init__(self):
        super(resnet,self).__init__()
        self.model = models.resnet18(pretrained=True)
        self.encoder = nn.Sequential(*list(self.model.children())[:-1])
    def forward(self,x):
        y = self.encoder(x)
        return y
net = resnet()