code: def _zero_grad_group_helper(group, set_to_none):
      """Zero out the gradient for a group of parameters.
      Note: copied from torch.optim.optimizer."""
      for param in group:
          if param.grad is not None:
              if set_to_none:
                  param.grad = None
              else:
                  if param.grad.grad_fn is not None:
                      param.grad.detach_()
                  else:
                      param.grad.requires_grad_(False)
                  param.grad.zero_()
  
imports: from abc import ABC
  from abc import abstractmethod
  from apex.multi_tensor_apply import multi_tensor_applier
  import amp_C
  import torch
  from megatron import get_timers
  from megatron import print_rank_0
  from megatron.core import mpu, tensor_parallel
  from megatron.model import Float16Module
  from megatron.model.module import param_is_not_shared
  from .clip_grads import clip_grad_norm_fp32, count_zeros_fp32
label_desc: Use image node_id 1 for calling a global function with example usage: _zero_grad_group_helper(group, set_to_none) without return types