torch.amp.autocast

Creator
Creator
Seonglae Cho
Created
Created
2023 Aug 20 15:8
Editor
Edited
Edited
2023 Aug 20 15:16
Refs
Refs

Python Context Manager

모델의 파라미터나 입력 데이터의 데이터타입을 half()를 사용하여 변경하지 않고 그대로 넣어도 자동적으로 precision을 mixing
loss 계산과 forward pass만 사용하길 권장 backward passes는 비추천
with torch.amp.autocast(): output = model(input) loss = loss_fn(output,target)
 
 
 

Python Decorator

class AutocastModel(nn.Module): @torch.cuda.amp.autocast() def forward(self, input):
 
 
 

Supported Operations

 
 

Recommendations