code: def to_master_grads(
      model_pgs: list,  # Fp16 model parameters to copy gradients from
      master_pgs: list,  # Fp32 model parameters to copy gradients to
      flat_master: bool = False,  # Whether or not fp32 parameters were previously flattened
  ):
      "Move fp16 model gradients to fp32 master gradients"
      for model_params, master_params in zip(model_pgs, master_pgs):
          model_grads_to_master_grads(
              model_params, master_params, flat_master=flat_master
          )
  
imports: from __future__ import annotations
  from ..basics import *
  from .progress import *
  from torch.cuda.amp import GradScaler, autocast
  from torch.cuda.amp.grad_scaler import OptState
  from ..fp16_utils import convert_network, model_grads_to_master_grads, master_params_to_model_params
  from torch.nn.utils import parameters_to_vector
label_desc: Use image node_id 5 for calling a global function with example usage: to_master_grads(model_pgs, master_pgs, flat_master) without return types