code: def zero_gard_by_list(
      tensor_list: List[Tensor], set_to_none: bool = True
  ) -> None:
      """Clear the gradient of a list of tensors,
  
      Note: copied from torch.optim.optimizer.
      """
      for param in tensor_list:
          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_()
  
label_desc: Use image node_id 2 for calling a global function with example usage: zero_gard_by_list(tensor_list, set_to_none) without return types