花费 6 ms
with torch.no_grad()用处

1、可以减少内存使用 2、训练集训练好模型后,在验证集这里使用with torch.no_grad(),训练集则不会计算梯度值,然后并不会改变模型的参数,只是看了训练的效果。 ...

Thu Dec 02 22:55:00 CST 2021 0 2372

 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM