In addition to my last response, I do not see requires_grad being set to True for the parameters of the resnet18 model anywhere in the code, so when exactly did gradients start to be tracked for the parameters?
Thanks again for your help,
Mahmoud