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.