code: def stash_expert_params(e, params, idx):
      e = e[idx]
      if not hasattr(e, "expert_param_stash"):
          setattr(e, "expert_param_stash", dict())
          setattr(e, "expert_grad_stash", dict())
      offset = 0
      for n, p in e.named_parameters():
          if n not in e.expert_param_stash:
              e.expert_param_stash[n] = p.data.clone()
              e.expert_grad_stash[n] = (
                  p.grad.clone() if p.grad is not None else None
              )
          with torch.no_grad():
              seg = params[offset : offset + p.numel()]
              offset += p.numel()
              p.copy_(seg.reshape(p.shape))
              p.grad = None
  
imports: import torch
label_desc: Use image node_id 3 for calling a global function with example usage: stash_expert_params(e, params, idx) without return types