Thanks for your reply!
So which way will be faster? torch.no_grad() or requires_grad=False?
In my view,  torch.no_grad() will not caculate grad of inputs of layers in the pretrained model, while requires_grad=False do. So  torch.no_grad() will be faster? Is that right?