class_docstr: A standard interface for optimizers wrapped by the Booster.
  
  Args:
      optim (Optimizer): The optimizer to be wrapped.
docstr: Clips gradient norm of an iterable of parameters.
  
  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.
      error_if_nonfinite (bool): if True, an error is raised if the total norm is non-finite. Default: False
  
  Note:
      In PyTorch Torch 2.0 and above, you can pass in foreach=True as kwargs to clip_grad_norm_ to use the
      faster implementation. Please refer to the PyTorch documentation for more details.
docstr_tok: ["Clips","gradient","norm","of","an","iterable","of","parameters",".","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",".","error_if_nonfinite","(","bool",")",":","if","True",",","an","error","is","raised","if","the","total","norm","is","non-finite",".","Default",":","False","Note",":","In","PyTorch","Torch","2.0","and","above",",","you","can","pass","in","foreach=True","as","kwargs","to","clip_grad_norm_","to","use","the","faster","implementation",".","Please","refer","to","the","PyTorch","documentation","for","more","details","."]
code: def clip_grad_by_norm(
      self,
      max_norm: Union[float, int],
      norm_type: Union[float, int] = 2.0,
      error_if_nonfinite: bool = False,
      *args,
      **kwargs,
  ) -> Tensor:
      """
      Clips gradient norm of an iterable of parameters.
  
      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.
          error_if_nonfinite (bool): if True, an error is raised if the total norm is non-finite. Default: False
  
      Note:
          In PyTorch Torch 2.0 and above, you can pass in foreach=True as kwargs to clip_grad_norm_ to use the
          faster implementation. Please refer to the PyTorch documentation for more details.
      """
      norm = nn.utils.clip_grad_norm_(
          self.parameters,
          max_norm,
          norm_type,
          error_if_nonfinite,
          *args,
          **kwargs,
      )
      return norm
  
imports: from typing import Union
  import torch
  import torch.nn
  from torch import Tensor
  from torch.optim import Optimizer
label_desc: Use image node_id 13 for calling the OptimizerWrapper obj's underlying member method code with example usage: obj.clip_grad_by_norm(max_norm, norm_type, error_if_nonfinite) and returns: norm