Dev record [Python] torch.no_grad() 역할 - 반응형 pytorch를 사용하다 보면 torch.no_grad()라는 걸 종종 확인할 수 있다. torch.no_grad()의 역할은 딥러닝 모델을 test, 즉 inference를 할 때에는 backpropagation이 진행되지 않는다. 즉, gradient 연산을 전혀 사용하지 않는다. 그렇기 때문에 굳이 torch에서 auto gradient 연산이 돌아가게 켜 둘 필요가 없다. 따라서 위 pytorch 공식 문서에 나와있는 것 처럼 gradient 연산을 꺼서 불필요한 메모리 사용량을 줄이는 것이 목적이다. https://pytorch.org/docs/stable/generated/torch.no_grad.html no_grad — PyTorch 2.0 documentation Shortcuts pytorch.org 반응형 공유하기 URL 복사카카오톡 공유페이스북 공유엑스 공유 게시글 관리 구독하기Barrer. better 저작자표시 비영리 변경금지 Contents 당신이 좋아할만한 콘텐츠 [ROS] Ubuntu 18.04 ros melodic에 Moveit 설치하기 2023.08.27 [Python] import torch.nn as nn 역할 2023.08.14 vscode WSL, ubuntu failed to save Error:EACCES: permission denied, open 2023.08.12 RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory 2023.08.11 댓글 0 + 이전 댓글 더보기