You could directly use these methods and objects via:
import torch
torch.cuda.amp.autocast
torch.cuda.amp.GradScaler

or could import them via:
from torch.cuda.amp import autocast
from torch.cuda.amp import GradScaler