torch.no_grad()

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2023 May 27 10:59
Editor
Edited
Edited
2024 May 6 15:58

Memory efficient (without back propagation)

validation inner loop를 이 context manager로 감싸서 gradient calculation을 방지
자동으로 gradient를 트래킹하지 않는다
The primary difference between torch.no_grad() and torch.inference_mode() in PyTorch is that torch.no_grad() temporarily disables gradient calculation, while torch.inference_mode() not only disables gradient computation but also optimizes specific operations for inference.
 
 
 
 
 

 

Recommendations