개발챙 AI study
/
Pytorch
/
nn.Module 의 register_buffer
Search
Share
nn.Module 의 register_buffer
Module - PyTorch 1.11.0 documentation
Base class for all neural network modules. Your models should also subclass this class. Modules can also contain other Modules, allowing to nest them in a tree structure. You can assign the submodules as regular attributes: Submodules assigned in this way will be registered, and will have their parameters converted too when you call , etc.
model 파라미터를 고려하지 않는 buffer를 등록할 때 주로 사용한다고 언급되어 있다.
즉, 값은 존재하여 layer처럼 작동하지만, optimizer가 업데이트 하지 않고
state_dict()로 확인이 가능하며
GPU 연산이 가능하다
네트워크 구성시 end to end로 학습을 시키고 싶으나 업데이트 하지 않는 일반 레이어가 필요할 때 사용가능하다고 할 수 있겠다