参考文献2写的比较详细,有图看起来很直观 参考文献 [1]【pytorch系列】 with torch.no_grad():用法详解 [2]什么时候该用with torch.no_grad()?什么时候该用.requires_grad ==False? [3]菜鸟进阶:(11)with torch.no_grad() 详解