정리/부캠-2
[부스트캠프 AI Tech] Day 8
gyubinc
2023. 3. 23. 00:26
과제 day
Pytorch Custom Modelling
torch.Tensor.view #resize
torch.gather #대각선 요소 가져오기
torch.nn.Linear #Linear transformation
torch.nn.Module #기본 module 클래스 상속
torch.nn.Sequential #sequential module container
torch.nn.ModuleList #List module container
torch.nn.ModuleDict #Dictionary module container
torch.nn.parameter.Parameter #parameter 설정
register_buffer #buffer 설정(parameter가 아닌 tensor 별도 저장)
model.named_children #한 단계 아래 submodule 표시
model.named_modules #모든 submodule 표시
model.get_submodule #특정 모듈 호출
model.named_parameters #parameter 이름, 객체 호출
model.get_parameters #parameter 호출
model.register_forward_pre_hook(module_hook) #순전파 pre_hook
model.register_forward_hook(module_hook) #순전파 hook
model.register_full_backward_hook(module_hook) #역전파 hook(pre는 없음)
model.apply(function) #후위순회로 model마다 function 적용