code: def zero_gradients(x):
      if isinstance(x, torch.Tensor):
          if x.grad is not None:
              x.grad.detach_()
              x.grad.zero_()
      elif isinstance(x, collections.abc.Iterable):
          for elem in x:
              zero_gradients(elem)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import collections
  import numpy
  import torch
  from torch.distributions import laplace
  from torch.distributions import uniform
  from torch.nn.modules.loss import _Loss
  from advertorch.utils import clamp
  from advertorch.utils import clamp_by_pnorm
  from advertorch.utils import batch_multiply
  from advertorch.utils import normalize_by_pnorm
  from advertorch.utils import predict_from_logits
  from advertorch.loss import ZeroOneLoss
  from advertorch.attacks import Attack, LabelMixin
label_desc: Use image node_id 1 for calling a global function with example usage: zero_gradients(x) without return types