Thank you for your answer.
but, I don’t use models in torchvision like resnet10 as a pre-traind model. I want to use my own model as a pre-trained model and transfer its layers and weights  except last layer to other model that has same structure. Also I want to freeze all the transferred weights in new model not to be optimized.
Is there any other ways to do this???