code: def _set_grad(x, grad):
      if getattr(x, "grad", None) is None:
          x.grad = grad
      else:
          x.grad += grad
  
imports: import typing
  from typing import Any, Iterator
  import torch
  from torch.nn import Parameter
  from fate.arch.context import Context
  from fate.arch.protocol.mpc.common.encoding import IgnoreEncodings
  from fate.arch.protocol.mpc.mpc import FixedPointEncoder
  from fate.arch.trace import auto_trace
label_desc: Use image node_id 2 for calling a global function with example usage: _set_grad(x, grad) without return types