I don’t quite understand your posted code and the explanations, since the code doesn’t compare anything or do you mean you are getting different results by rerunning the entire script twice?
In the latter case, this would be expected, as you are randomly initializing the resnet18. If you want to load the pretrained model, use pretrained=True, or load a custom state_dict otherwise.