How can l use the pre-trained Resnet to extract feautres from my own dataset?

after looking at a few other blogs, this seemed to work for me

new_classifier = nn.Sequential(*list(loaded_model.children())[:-1])
model = new_classifier
outputs = model(input_image.unsqueeze_(0).cuda())
outputs = outputs.view(-1)