Extract feature

hi all, i came across some puzzle when using a trained net to extract feature, here is the problem:

  1. trained a resnet50 for classification task, and extract the feature from feature lay,which is a fc layer before classification layer.
  2. i tried two ways to do the feature extracting ,
    model.fc = nn.Sequential()
    model = nn.Sequential(*list(model.children())[:-1])
  3. the speed of extracting feature is very slow when using the second method and the first is very fast.

is there anyone can explain it ?