docstr: Clips fp32 master gradients via ``torch.nn.utils.clip_grad_norm``.
  
  Args:
      max_norm (float or int): max norm of the gradients
      norm_type (float or int): type of the used p-norm. Can be ``'inf'`` for
          infinity norm.
  
  Returns:
      Total norm of the current fp32 gradients (viewed as a single vector).
  
  .. warning::
      Returns -1 if the most recently computed fp16 gradients overflowed (that is, if ``self.overflow`` is ``True``).
docstr_tok: ["Clips","fp32","master","gradients","via","``","torch.nn.utils.clip_grad_norm","``",".","Args",":","max_norm","(","float","or","int",")",":","max","norm","of","the","gradients","norm_type","(","float","or","int",")",":","type","of","the","used","p-norm",".","Can","be","``","'inf","'","``","for","infinity","norm",".","Returns",":","Total","norm","of","the","current","fp32","gradients","(","viewed","as","a","single","vector",")",".","..","warning",":",":","Returns","-1","if","the","most","recently","computed","fp16","gradients","overflowed","(","that","is",",","if","``","self.overflow","``","is","``","True","``",")","."]
code: def clip_master_grads(self, max_norm, norm_type=2):
      """
      Clips fp32 master gradients via ``torch.nn.utils.clip_grad_norm``.
  
      Args:
          max_norm (float or int): max norm of the gradients
          norm_type (float or int): type of the used p-norm. Can be ``'inf'`` for
              infinity norm.
  
      Returns:
          Total norm of the current fp32 gradients (viewed as a single vector).
  
      .. warning::
          Returns -1 if the most recently computed fp16 gradients overflowed (that is, if ``self.overflow`` is ``True``).
      """
      if not self.overflow:
          fp32_params = []
          for param_group in self.optimizer.param_groups:
              for param in param_group["params"]:
                  fp32_params.append(param)
          return self.clip_grad_norm(fp32_params, max_norm, norm_type)
      else:
          return -1
  
imports: import torch
  from torch import nn
  from torch.autograd import Variable
  from torch.nn.parameter import Parameter
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
  from ..amp._amp_state import _amp_state, maybe_print
  from ..amp.scaler import LossScaler
  from ..multi_tensor_apply import multi_tensor_applier
  from .fp16util import model_grads_to_master_grads, master_params_to_model_params, clip_grad_norm
label_desc: Use image node_id 7 for calling the FP16_Optimizer obj's underlying member method code with example usage: obj.clip_master_grads(max_norm, norm_type) and returns: self, unknown