We still can get gradients from model parameters when we set resnet101.eval() because eval mode is to deactivate above-mentioned stochastic modules like dropout or batchnorm. it does not deactivate autograd engine.
(1) Does model.eval() & with torch.set_grad_enabled(is_train) have the same effect for grad history? 4
(2) 'model.eval()' vs 'with torch.no_grad()' 2