code: def grad_scaler(c: TrainerConf):
      if not c.is_amp:
          return None
  
      if c.dtype == torch.float16:
          from labml_nn.optimizers.adam_fp16 import GradScalerFP16
  
          return GradScalerFP16()
      else:
          return GradScaler()
  
imports: from typing import Optional, Set, List
  import torch.nn
  import torch.optim
  import torch.utils.data
  from torch.cuda import amp
  from torch.cuda.amp import GradScaler
  from labml import monit, tracker
  from labml.configs import BaseConfigs, option
  from labml_nn.neox.utils.finetune import FineTuner
label_desc: Use image node_id 4 for calling a global function with example usage: grad_scaler(c) and returns: None, GradScalerFP16, GradScaler