code: def copy_grad(target_link, source_link):
      """Copy gradients of a link to another link."""
      target_params = dict(target_link.namedparams())
      for param_name, param in source_link.namedparams():
          if target_params[param_name].grad is None:
              if param.grad is None:
                  pass
              else:
                  target_params[param_name].grad = param.grad.copy()
          else:
              if param.grad is None:
                  target_params[param_name].grad = None
              else:
                  target_params[param_name].grad[...] = param.grad
  
imports: from chainer import links
label_desc: Use image node_id 3 for calling a global function with example usage: copy_grad(target_link, source_link) without return types